diff --git a/src/compiler/compile/css/Stylesheet.ts b/src/compiler/compile/css/Stylesheet.ts index 49f11bc1f2..d448cda58e 100644 --- a/src/compiler/compile/css/Stylesheet.ts +++ b/src/compiler/compile/css/Stylesheet.ts @@ -217,6 +217,11 @@ class Atrule { if (type === 'Identifier') { if (name.startsWith('-global-')) { code.remove(start, start + 8); + this.children.forEach((rule: Rule) => { + rule.selectors.forEach(selector => { + selector.used = true; + }); + }); } else { code.overwrite(start, end, keyframes.get(name)); } diff --git a/test/css/samples/global-keyframes-with-no-elements/expected.css b/test/css/samples/global-keyframes-with-no-elements/expected.css new file mode 100644 index 0000000000..50a57ac471 --- /dev/null +++ b/test/css/samples/global-keyframes-with-no-elements/expected.css @@ -0,0 +1 @@ +@keyframes why{0%{color:red}100%{color:blue}} \ No newline at end of file diff --git a/test/css/samples/global-keyframes-with-no-elements/input.svelte b/test/css/samples/global-keyframes-with-no-elements/input.svelte new file mode 100644 index 0000000000..09499df7ee --- /dev/null +++ b/test/css/samples/global-keyframes-with-no-elements/input.svelte @@ -0,0 +1,6 @@ + \ No newline at end of file