Skip to content

Commit 903d95b

Browse files
committed
fix: πŸ› prefixed keyframes globalization
βœ… Closes: #264
1 parent db6993e commit 903d95b

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Diff for: β€Žsrc/transformers/globalStyle.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ const globalAttrPlugin = (root: postcss.Root) => {
4646
});
4747

4848
root.walkRules((rule) => {
49-
if ((rule?.parent as AtRule)?.name === 'keyframes') {
49+
// we use endsWith for checking @keyframes and prefixed @-{prefix}-keyframes
50+
if ((rule?.parent as AtRule)?.name?.endsWith('keyframes')) {
5051
return;
5152
}
5253

Diff for: β€Žtest/transformers/globalStyle.test.ts

+13
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ describe('transformer - globalStyle', () => {
5050
);
5151
});
5252

53+
it('supports prefixed @keyframes', async () => {
54+
const template = `<style global>
55+
@-webkit-keyframes a {from{} to{}}@-webkit-keyframes -global-b {from{} to{}}
56+
</style>`;
57+
58+
const opts = autoProcess();
59+
const preprocessed = await preprocess(template, opts);
60+
61+
expect(preprocessed.toString()).toContain(
62+
`@-webkit-keyframes -global-a {from{} to{}}@-webkit-keyframes -global-b {from{} to{}}`,
63+
);
64+
});
65+
5366
it('allows to use :local() at the beginning of a selector', async () => {
5467
const template = `<style global>:local(div) .test{}</style>`;
5568
const opts = autoProcess();

0 commit comments

Comments
Β (0)