Skip to content

Commit

Permalink
fix: Keep keyframe decimals for prefixed @Keyframes (#749)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianBannister committed Oct 3, 2021
1 parent b0adcd0 commit b804441
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions packages/purgecss/__tests__/keyframes.test.ts
Expand Up @@ -90,3 +90,34 @@ describe("keep keyframe decimals", () => {
expect(purgedCSS.includes("99.9%")).toBe(true);
});
});

describe("keep webkit keyframe decimals", () => {
let purgedCSS: string;
beforeAll(async () => {
const resultsPurge = await new PurgeCSS().purge({
content: [
{
raw: '<div class="xx"></div>',
extension: "html",
},
],
css: [
{
raw: `
@-webkit-keyframes xxx {
0% {opacity: 0;}
99.9% {opacity: 1;}
}
.xx { animation: xxx 200ms linear both }
`,
},
],
keyframes: false,
});
purgedCSS = resultsPurge[0].css;
});

it("keeps `99.9%`", () => {
expect(purgedCSS.includes("99.9%")).toBe(true);
});
});
2 changes: 1 addition & 1 deletion packages/purgecss/src/index.ts
Expand Up @@ -439,7 +439,7 @@ class PurgeCSS {
if (
node.parent &&
isPostCSSAtRule(node.parent) &&
node.parent.name === "keyframes"
node.parent.name.endsWith("keyframes")
) {
return;
}
Expand Down

0 comments on commit b804441

Please sign in to comment.