From 6ba1e8f8758ec76038b946babc765e3cbc10ec66 Mon Sep 17 00:00:00 2001 From: "alexander.akait" Date: Thu, 20 Oct 2022 23:18:11 +0300 Subject: [PATCH] test(css/minifier): layer --- .../fixture/compress-at-rule/layer/input.css | 68 +++++++++++++++++++ .../compress-at-rule/layer/output.min.css | 1 + 2 files changed, 69 insertions(+) create mode 100644 crates/swc_css_minifier/tests/fixture/compress-at-rule/layer/input.css create mode 100644 crates/swc_css_minifier/tests/fixture/compress-at-rule/layer/output.min.css diff --git a/crates/swc_css_minifier/tests/fixture/compress-at-rule/layer/input.css b/crates/swc_css_minifier/tests/fixture/compress-at-rule/layer/input.css new file mode 100644 index 000000000000..a36428125cdd --- /dev/null +++ b/crates/swc_css_minifier/tests/fixture/compress-at-rule/layer/input.css @@ -0,0 +1,68 @@ +@layer default, theme, components; +@layer foo.bar; +@layer foo.bar, baz; + +@layer framework { + @layer layout { + @layer base { + } + } +} +@layer a{ + @layer b { + div {color: yellow; margin: 0px;} + } +} + +@layer framework { + @layer base { + p { margin-block: 0.75em; } + } + + @layer theme { + p { color: #222; } + } +} + +@layer framework.theme { + /* These styles will be added to the theme layer inside the framework layer */ + blockquote { color: rebeccapurple; } +} + +@layer { + @layer foo { + color: red; + } + @layer foo { + color: red; + } +} + +@layer { + @layer foo { color: red; } +} +@layer { + @layer foo { color: red; } +} + +@layer framework { + h1, h2 { color: maroon; background: white;} + + @media (prefers-color-scheme: dark) { + h1, h2 { color: red; background: black; } + } +} + +@layer foo { + .foo { + color: red; + } +} +@layer foo { + .foo { + background: #fff; + } + .baz { + color: #fff; + } +} diff --git a/crates/swc_css_minifier/tests/fixture/compress-at-rule/layer/output.min.css b/crates/swc_css_minifier/tests/fixture/compress-at-rule/layer/output.min.css new file mode 100644 index 000000000000..ee47d2c5c6e6 --- /dev/null +++ b/crates/swc_css_minifier/tests/fixture/compress-at-rule/layer/output.min.css @@ -0,0 +1 @@ +@layer default,theme,components;@layer foo.bar;@layer foo.bar,baz;@layer framework{}@layer a{@layer b{div{color:yellow;margin:0}}}@layer framework{@layer base{p{margin-block:.75em}}@layer theme{p{color:#222}}}@layer framework.theme{blockquote{color:rebeccapurple}}@layer{@layer foo{color: red;}@layer foo{color: red;}}@layer{@layer foo{color: red;}}@layer{@layer foo{color: red;}}@layer framework{h1,h2{color:maroon;background:white}@media(prefers-color-scheme:dark){h1,h2{color:red;background:black}}}@layer foo{.foo{color:red}}@layer foo{.foo{background:#fff}.baz{color:#fff}}