postcss-critical-split icon indicating copy to clipboard operation
postcss-critical-split copied to clipboard

Is there a way to pass a whitelist of class selectors in config instead of annotating in css?

Open afzalsayed96 opened this issue 5 years ago • 2 comments

afzalsayed96 avatar Apr 10 '20 08:04 afzalsayed96

Sounds like a nice feature but no, this does not yet exist. Giving it some thought, I can easily see this become REALLY complicated and bug prone (since we'll have to interpret the selectors in the list according to the CSS spec and match them against the traversal list int he css files itself.

Since some selectors might include selectors that are in the file but not with exact matches.

Example whitelist: body > p > span.label css file: p > span.label

This could easily become a very complicated feature with many potential bugs.

mrnocreativity avatar Apr 10 '20 08:04 mrnocreativity

That's a valid example. I don't know how we can handle that. Maybe instead of selectors, user can provide a selector pattern.

This feature would be very helpful for those who are using a css library and want to mark some of the styles as critical inside the lib.

afzalsayed96 avatar Apr 11 '20 08:04 afzalsayed96