-
-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor keyframe purge to use the postcss api #34
Conversation
Thanks, this is great. There are some improvement that can be made related to performance. When the One other thing to get into consideration is the number of time purgecss will walk through the AST. Each I don't think we can avoid walking through the AST less than 2 times because we need to gather the used keyframes first. But we can combine removing the unused css and unused keyframes. |
Good point, I defined a I'm not sure how we can combine the |
Passing the root to the purging functions is the choice I would make but it is just a detail at this point. import { getSelectorsInCss } from 'purgecss' But that is not a priority and defining a root variable in the class object is ok. To combine the if ( !callback ) {
callback = prop;
return this.walk( (child, i) => {
if ( child.type === 'decl' ) {
return callback(child, i);
}
});
} You can see that the function calls |
Thanks again for the PR. I will release a new version on npm with the changes this week-end. |
Update rollup to the latest version 🚀
Proposed changes
Use postcss to remove unused keyframes
Types of changes
Checklist