0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-29 16:36:44 +01:00

Merge pull request #796 from sveltejs/gh-757

handle css vars in <style> tags
This commit is contained in:
Rich Harris 2017-08-29 11:23:50 -04:00 committed by GitHub
commit 0efa2ac7d7
3 changed files with 16 additions and 3 deletions

View File

@ -135,10 +135,15 @@ class Declaration {
minify(code: MagicString) {
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) {
code.overwrite(c, first.start, ':');
let start = first.start;
while (/\s/.test(code.original[start])) start += 1;
if (start - c > 1) {
code.overwrite(c, start, ':');
}
}
}

View File

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

View File

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