Markup incorrectly parsed after <style global> SCSS flag
See original GitHub issueDescribe the bug
HTML Svelte interpolated code with comparisons {condition === 2}
starts to make the rest of the file to be wrongly parsed after <style> tag if ‘global’ flag is provided at the end of the style tag for SCSS preprocessors.
This does not affect builds and the same svelte.config is both used for rollup and for vscode with the preprocessor.
To Reproduce
- The order of the Svelte file has to be
script - style - markup
. - Style has to use
global
preprocessor flag attribute after any other attrib like<style src="./path.scss" global>
- In the markup, inside interpolated Svelte code ({expressions}) there should be a boolean comparison (this is the only case I found but there might be more) like
{x === 2}
.
Minimal reproducible example:
<script>let whatever = 1; /* it does not matter */</script>
<style src="./aFile.scss" global> // <-- 'global' has to be last
{whatever === 1} // <-- last '}' will give you error, then almost any other not native html code
Expected behavior Nothing should be prompted unless it is a real error.
Screenshots
System (please complete the following information):
- OS: Mojave. Mac
- IDE: VSCode
- Plugin/Package: only “Svelte Beta” (No “Svelte” or “Svelte Type Check” or similar)
WORKAROUND
I found out that if global
is set just before the src=""
attribute, the compiler will work.
This clarifies that this issue is, in fact, from the language-tool, perhaps as a conflict with other built-in plugins from VSCode
<script>let whatever = 1; /* it does not matter */</script>
<style global src="./aFile.scss">
{whatever === 1} // This works
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (7 by maintainers)
Fixed in the last deployed version 🙇 👍
It is autodeployed nightly, in about 8 hours.