Skip to content

Commit b804441

Browse files
fix: Keep keyframe decimals for prefixed @Keyframes (#749)
1 parent b0adcd0 commit b804441

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

packages/purgecss/__tests__/keyframes.test.ts

+31
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,34 @@ describe("keep keyframe decimals", () => {
9090
expect(purgedCSS.includes("99.9%")).toBe(true);
9191
});
9292
});
93+
94+
describe("keep webkit keyframe decimals", () => {
95+
let purgedCSS: string;
96+
beforeAll(async () => {
97+
const resultsPurge = await new PurgeCSS().purge({
98+
content: [
99+
{
100+
raw: '<div class="xx"></div>',
101+
extension: "html",
102+
},
103+
],
104+
css: [
105+
{
106+
raw: `
107+
@-webkit-keyframes xxx {
108+
0% {opacity: 0;}
109+
99.9% {opacity: 1;}
110+
}
111+
.xx { animation: xxx 200ms linear both }
112+
`,
113+
},
114+
],
115+
keyframes: false,
116+
});
117+
purgedCSS = resultsPurge[0].css;
118+
});
119+
120+
it("keeps `99.9%`", () => {
121+
expect(purgedCSS.includes("99.9%")).toBe(true);
122+
});
123+
});

packages/purgecss/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ class PurgeCSS {
439439
if (
440440
node.parent &&
441441
isPostCSSAtRule(node.parent) &&
442-
node.parent.name === "keyframes"
442+
node.parent.name.endsWith("keyframes")
443443
) {
444444
return;
445445
}

0 commit comments

Comments
 (0)