Skip to content

Commit

Permalink
Fix: analyzer breaks on @layer {} because it has no prelude
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart Veneman committed Nov 1, 2023
1 parent 417665f commit 99d569d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/atrules/atrules.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ AtRules('finds @layer', () => {
@layer components {
@layer defaults, structures, themes, utilities;
}
@layer {
test {
color: green;
}
}
`
const actual = analyze(fixture).atrules.layer
const expected = {
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export function analyze(css, options = {}) {
containers.push(stringifyNode(node.prelude), node.prelude.loc)
break
}
if (atRuleName === 'layer') {
if (atRuleName === 'layer' && node.prelude !== null) {
let prelude = stringifyNode(node.prelude)
prelude
.split(',')
Expand Down

0 comments on commit 99d569d

Please sign in to comment.