handle css vars in <style> tags (fixes #757)

pull/796/head
Rich Harris 7 years ago
parent 87ef5ffefd
commit ff2e169b75

@ -135,10 +135,15 @@ class Declaration {
minify(code: MagicString) { minify(code: MagicString) {
const c = this.node.start + this.node.property.length; const c = this.node.start + this.node.property.length;
const first = this.node.value.children[0]; const first = this.node.value.children ?
this.node.value.children[0] :
this.node.value;
if (first.start - c > 1) { let start = first.start;
code.overwrite(c, first.start, ':'); while (/\s/.test(code.original[start])) start += 1;
if (start - c > 1) {
code.overwrite(c, start, ':');
} }
} }
} }

@ -0,0 +1 @@
div[svelte-xyz],[svelte-xyz] div{--test:10}

@ -0,0 +1,7 @@
<div></div>
<style>
div {
--test: 10;
}
</style>
Loading…
Cancel
Save