Skip to content
Merged
Prev Previous commit
Next Next commit
add check that allows @charset and @layer foo, bar; at the top
These don't have to be wrapped in a layer.
  • Loading branch information
RobinMalfait committed Sep 30, 2024
commit 67ae8b4f5b34f7d94158455608fdfc7faba70dd8
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,14 @@ export function migrateMissingLayers(): Plugin {
}
}

// (License) comments can stay at the top, when we haven't found any
// `@tailwind` at-rules yet.
if (lastLayer === '' && node.type === 'comment') {
// (License) comments, body-less `@layer` and `@charset` can stay at the
// top, when we haven't found any `@tailwind` at-rules yet.
if (
lastLayer === '' &&
(node.type === 'comment' /* Comment*/ ||
(node.type === 'atrule' && !node.nodes) || // @layer foo, bar, baz;
(node.type === 'atrule' && node.name === 'charset')) // @charset "UTF-8";
) {
return
}

Expand Down