Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/parse-statements.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ module.exports = function parseStatements(result, styles, conditions, from) {
!node.nodes
)
stmt = parseLayer(result, node, conditions, from)
} else if (node.type !== "comment") {
}

if (!stmt && node.type !== "comment") {
encounteredNonImportNodes = true
}

Expand Down
21 changes: 21 additions & 0 deletions test/fixtures/imports/layer-empty-after-content-pkg.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@layer base {
html {
box-sizing: border-box;
}
}
@layer layout {
.container {
display: flex;
}
}
@layer components {
.btn {
padding: 8px;
}
}
@layer utils {
.hidden {
display: none;
}
}
@layer overrides;
6 changes: 6 additions & 0 deletions test/fixtures/layer-empty-after-content.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@import url("layer-empty-after-content-pkg.css");
@layer overrides {
body {
background-color: #e5e5e5;
}
}
26 changes: 26 additions & 0 deletions test/fixtures/layer-empty-after-content.expected.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@layer base {
html {
box-sizing: border-box;
}
}
@layer layout {
.container {
display: flex;
}
}
@layer components {
.btn {
padding: 8px;
}
}
@layer utils {
.hidden {
display: none;
}
}
@layer overrides;
@layer overrides {
body {
background-color: #e5e5e5;
}
}
6 changes: 6 additions & 0 deletions test/layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,9 @@ test(
checkFixture,
"layer-statement-with-conditions",
)

test(
"should preserve the order of layer statements that follow layer blocks",
checkFixture,
"layer-empty-after-content",
)