Skip to content

Commit fff39cf

Browse files
committed
This tool should ignore @layer
1 parent 71f7631 commit fff39cf

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

test/tool.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,24 @@ describe('At-rule Packer', () => {
249249
);
250250
});
251251

252+
it('Should not merge @layer', async () => {
253+
const css = `
254+
@layer {
255+
font-family: 'Open Sans';
256+
}
257+
258+
@layer reset, body;
259+
260+
@layer reset {
261+
font-family: 'Open Serif';
262+
}
263+
`;
264+
265+
expect(clearWhiteSpaceAndCallATP(css)).toBe(
266+
`@layer{font-family:'OpenSans';}@layerreset,body;@layerreset{font-family:'OpenSerif';}`
267+
);
268+
});
269+
252270
it('Real life example leveraging CSS variables', async () => {
253271
const css = `
254272
@media (min-width: 45em) {

tool/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function untilAtRule(atrule: ChildNode, forward?: boolean): AtRule | undefined {
2626
/* eslint-enable consistent-return */
2727

2828
// List of Atrule's that should never be merged
29-
const ignoredAtRules = ['import', 'font-face', 'when', 'else'];
29+
const ignoredAtRules = ['import', 'font-face', 'layer', 'when', 'else'];
3030

3131
function processAtrule(atrule: AtRule): void {
3232
// Ignore at-rules that should not be merged

0 commit comments

Comments
 (0)