diff --git a/src/css/Stylesheet.ts b/src/css/Stylesheet.ts index 5680ec4551..03f3d4ec06 100644 --- a/src/css/Stylesheet.ts +++ b/src/css/Stylesheet.ts @@ -144,7 +144,8 @@ class Atrule { minify(code: MagicString, cascade: boolean) { if (this.node.name === 'media') { - let c = this.node.start + 6; + const expressionChar = code.original[this.node.expression.start]; + let c = this.node.start + (expressionChar === '(' ? 6 : 7); if (this.node.expression.start > c) code.remove(c, this.node.expression.start); this.node.expression.children.forEach((query: Node) => { diff --git a/test/css/samples/media-query-word/expected.css b/test/css/samples/media-query-word/expected.css new file mode 100644 index 0000000000..3975992f2a --- /dev/null +++ b/test/css/samples/media-query-word/expected.css @@ -0,0 +1 @@ +@media only screen and (min-width: 400px){div[svelte-xyz],[svelte-xyz] div{color:red}} \ No newline at end of file diff --git a/test/css/samples/media-query-word/input.html b/test/css/samples/media-query-word/input.html new file mode 100644 index 0000000000..342b003b62 --- /dev/null +++ b/test/css/samples/media-query-word/input.html @@ -0,0 +1,9 @@ +