Merge pull request #1200 from leereamsnyder/process-atsupports

process code in @supports queries with cascade: false
pull/1218/head
Rich Harris 7 years ago committed by GitHub
commit 91a04cfb88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -163,7 +163,7 @@ class Atrule {
}
apply(node: Element, stack: Element[]) {
if (this.node.name === 'media') {
if (this.node.name === 'media' || this.node.name === 'supports') {
this.children.forEach(child => {
child.apply(node, stack);
});
@ -199,6 +199,14 @@ class Atrule {
if (this.node.expression.start - c > 1) code.overwrite(c, this.node.expression.start, ' ');
c = this.node.expression.end;
if (this.node.block.start - c > 0) code.remove(c, this.node.block.start);
} else if (this.node.name === 'supports') {
let c = this.node.start + 9;
if (this.node.expression.start - c > 1) code.overwrite(c, this.node.expression.start, ' ');
this.node.expression.children.forEach((query: Node) => {
// TODO minify queries
c = query.end;
});
code.remove(c, this.node.block.start);
}
// TODO other atrules

@ -0,0 +1,3 @@
export default {
cascade: false
};

@ -0,0 +1 @@
@supports (display: grid){.maybe-grid[svelte-xyz]{display:grid}}

@ -0,0 +1,9 @@
<div class='maybe-grid'>something with a nice layout</div>
<style>
@supports (display: grid) {
.maybe-grid {
display: grid;
}
}
</style>
Loading…
Cancel
Save