diff --git a/src/compiler/compile/css/Stylesheet.ts b/src/compiler/compile/css/Stylesheet.ts index 8f88f0cbd4..7f0c0b52ca 100644 --- a/src/compiler/compile/css/Stylesheet.ts +++ b/src/compiler/compile/css/Stylesheet.ts @@ -145,6 +145,8 @@ class Declaration { ? this.node.value.children[0] : this.node.value; + if (first.type === 'Raw' && /^\s+$/.test(first.value)) return; + let start = first.start; while (/\s/.test(code.original[start])) start += 1; diff --git a/test/css/samples/css-vars/expected.css b/test/css/samples/css-vars/expected.css index c2bd56375b..3c252b8d05 100644 --- a/test/css/samples/css-vars/expected.css +++ b/test/css/samples/css-vars/expected.css @@ -1 +1 @@ -:root{--root-test:20}div.svelte-xyz{--test:10} \ No newline at end of file +:root{--root-test:20}div.svelte-xyz{--test:10}div.svelte-xyz{--foo: } \ No newline at end of file diff --git a/test/css/samples/css-vars/input.svelte b/test/css/samples/css-vars/input.svelte index 7aa48617a4..3679e0d453 100644 --- a/test/css/samples/css-vars/input.svelte +++ b/test/css/samples/css-vars/input.svelte @@ -7,4 +7,8 @@ div { --test: 10; } + + div { + --foo: ; + }