Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix import with layer; add nameLayer option (#496)
* fix import with layer * one more fix * remove unreachable code * fix anonymous layers * fix anonymous layers * basic implementation * add warning * cleanup and more tests * use the rootFilename
- Loading branch information
1 parent
64867f4
commit 64dd1c2
Showing
17 changed files
with
608 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
@import url("layer-level-2-anonymous.css") layer; | ||
|
||
body { | ||
order: 1; | ||
} | ||
|
||
@media (min-width: 50rem) { | ||
body { | ||
order: 2; | ||
} | ||
} | ||
|
||
@keyframes RED_TO_BLUE { | ||
0% { | ||
background-color: red; | ||
} | ||
100% { | ||
background-color: blue; | ||
} | ||
} | ||
|
||
@supports (display: grid) { | ||
body { | ||
display: grid; | ||
order: 3; | ||
} | ||
} | ||
|
||
@layer A { | ||
body { | ||
order: 4; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@import url("layer-level-3.css") layer (min-width: 320px); | ||
|
||
@layer Y { | ||
body { | ||
color: purple; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@import url("layer-level-3.css") layer(level-3) (min-width: 320px); | ||
|
||
@layer Y { | ||
body { | ||
color: purple; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@layer Z { | ||
body { | ||
color: cyan; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
rule-one {} | ||
|
||
rule-two {} | ||
|
||
@media (min-width: 50rem) { | ||
rule-three {} | ||
|
||
rule-four {} | ||
} | ||
|
||
rule-five {} | ||
|
||
rule-six {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
@import url("layer-level-2.css") layer(level-2); | ||
|
||
body { | ||
order: 1; | ||
} | ||
|
||
@media (min-width: 50rem) { | ||
body { | ||
order: 2; | ||
} | ||
} | ||
|
||
@keyframes RED_TO_BLUE { | ||
0% { | ||
background-color: red; | ||
} | ||
100% { | ||
background-color: blue; | ||
} | ||
} | ||
|
||
@supports (display: grid) { | ||
body { | ||
display: grid; | ||
order: 3; | ||
} | ||
} | ||
|
||
@layer A { | ||
body { | ||
order: 4; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@import url("layer-anonymous.css") layer screen; | ||
|
||
@import url("layer-anonymous.css") layer; |
127 changes: 127 additions & 0 deletions
127
test/fixtures/layer-import-atrules-anonymous.expected.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
@media screen and (min-width: 320px) { | ||
@layer import-anon-layer-0.import-anon-layer-1.import-anon-layer-2 { | ||
@layer Z { | ||
body { | ||
color: cyan; | ||
} | ||
} | ||
} | ||
} | ||
|
||
@media screen { | ||
@layer import-anon-layer-0.import-anon-layer-1 { | ||
|
||
@layer Y { | ||
body { | ||
color: purple; | ||
} | ||
} | ||
} | ||
} | ||
|
||
@media screen { | ||
@layer import-anon-layer-0 { | ||
|
||
body { | ||
order: 1; | ||
} | ||
} | ||
} | ||
|
||
@media screen { | ||
@layer import-anon-layer-0 { | ||
|
||
@media (min-width: 50rem) { | ||
body { | ||
order: 2; | ||
} | ||
} | ||
} | ||
} | ||
|
||
@media screen { | ||
@layer import-anon-layer-0 { | ||
|
||
@keyframes RED_TO_BLUE { | ||
0% { | ||
background-color: red; | ||
} | ||
100% { | ||
background-color: blue; | ||
} | ||
} | ||
|
||
@supports (display: grid) { | ||
body { | ||
display: grid; | ||
order: 3; | ||
} | ||
} | ||
|
||
@layer A { | ||
body { | ||
order: 4; | ||
} | ||
} | ||
} | ||
} | ||
|
||
@media (min-width: 320px) { | ||
@layer import-anon-layer-3.import-anon-layer-4.import-anon-layer-5 { | ||
@layer Z { | ||
body { | ||
color: cyan; | ||
} | ||
} | ||
} | ||
} | ||
|
||
@layer import-anon-layer-3.import-anon-layer-4 { | ||
|
||
@layer Y { | ||
body { | ||
color: purple; | ||
} | ||
} | ||
} | ||
|
||
@layer import-anon-layer-3 { | ||
|
||
body { | ||
order: 1; | ||
} | ||
} | ||
|
||
@layer import-anon-layer-3 { | ||
|
||
@media (min-width: 50rem) { | ||
body { | ||
order: 2; | ||
} | ||
} | ||
} | ||
|
||
@layer import-anon-layer-3 { | ||
|
||
@keyframes RED_TO_BLUE { | ||
0% { | ||
background-color: red; | ||
} | ||
100% { | ||
background-color: blue; | ||
} | ||
} | ||
|
||
@supports (display: grid) { | ||
body { | ||
display: grid; | ||
order: 3; | ||
} | ||
} | ||
|
||
@layer A { | ||
body { | ||
order: 4; | ||
} | ||
} | ||
} |
Oops, something went wrong.