-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot use self-closing <style /> or <script /> tags #196
Comments
The Svelte compiler does not support self-closing
I prefer the first option. @Conduitry is there something that speaks against implementing this inside the parser? In the meantime, do |
@dummdidumm thanks. It works. |
I have run into the same issue, however not due to self-closing tag. // Test.svelte
<script>
...
$: containerStylesHtml = `<style>${containerStyles}</style>`;
</script> Run cmd, or "Format document" action in vscode when svelte plugin installed: npx prettier --write --plugin-search-dir=. ./**/*.svelte Results in: $: containerStylesHtml = `<style ✂prettier:content✂="JHtjb250YWluZXJTdHlsZXN9"></style>`; Workaround escape style closing tag like so: :/ $: containerStylesHtml = `<style>${containerStyles}<\/style>`; |
I have the same error if I select something in Webstorm and then run the format code: Screen.Recording.2021-04-19.at.15.04.10.mov |
@mataslib this issue is tracked in #219 |
Closing for housekeeping reasons. The original issue was "works as designed"/"svelte compiler limitation", the other issues were unrelated. |
I try to run format svelte files but have an error
[error] lobby\Armory.svelte: Expected > [error] > 1 | <style type="text/scss" src="./Armory.scss"/><script ✂prettier:content✂="CgogICAgaW1wb3J0IFN0YXRCYXIgZnJvbSAnLi9TdGF0QmFyLnN2ZWx0ZSc7CiAgICBpbXBvcnQgQXJtb3J5U2xvdCBmcm9tICcuL0FybW9yeVNsb3Quc3ZlbHRlJzsKCiAgICBsZXQgc3Rhd HMgPSBbCiAgICAgICAgeyBuYW1lOidEYW1hZ2UnLCBwcm9ncmVzczo1MCwgZGlmZjo2MCB9LAogICAgICAgIHsgbmFtZTonUmFuZ2UnLCBwcm9ncmVzczozMCwgZGlmZjozNSB9LAogICAgICAgIHsgbmFtZTonUmF0ZSBvZiBmaXJlJywgcHJvZ3Jlc3M6NjAsIGRpZmY6NTAgfSwKICAgICAgICB7IG5hbWU6J 0FpbSBhY2N1cmFjeScsIHByb2dyZXNzOjIwLCBkaWZmOjQwIH0sCiAgICAgICAgeyBuYW1lOidIaXAgQWNjdXJhY3knLCBwcm9ncmVzczo3MCwgZGlmZjo3MCB9LAogICAgICAgIHsgbmFtZTonQW1tbyBjYXBhY2l0eScsIHByb2dyZXNzOjQwLCBkaWZmOjEwIH0sCiAgICBdOwoKICAgIGxldCBzbG90cyA9I FsKICAgICAgICB7IH0sCiAgICAgICAgeyBuYW1lOidBcGVydHVyZSBTaWdodCcsIGltYWdlOicvYnVpbGQvYXNzZXRzL3NpZ2h0cy9hcGVydHVyZS5wbmcnIH0sCiAgICAgICAgeyBsb2NrZWQ6dHJ1ZSB9LAogICAgICAgIHsgbG9ja2VkOnRydWUgfSwKICAgICAgICB7IGxvY2tlZDp0cnVlIH0sCiAgICBdO woK">{}</script><div class="armory">
I use
"prettier": "^2.2.1",
"prettier-plugin-svelte": "^2.1.1",
The text was updated successfully, but these errors were encountered: