add known_pseudo_classes to the codebase to prevent unnecessary invalidations on :global and :local#1231
Conversation
…idations on :global and :local
|
This should resolve #1079 |
|
@devongovett sorry for the bump here, this is just high on my priority list at the moment so I needed to follow up. If this isn't something you're interested in, let me know. I do have a custom visitor written that does this same thing more or less, but would greatly prefer to be able to use an actual API from lightningcss. |
|
@calebdwilliams I wouldn't expect a quick response here. Personally, I decided to move away from Lightning CSS for now and use other tools until things improve. Although we experienced a slight dip in build performance, I found it difficult to accept some of the less obvious "optimizations" and "transformations" just like shown in this pull request, which cannot be disabled. The minification optimizations are more aggressive, but alternative tools label them as "unsafe" and exclude them from default presets. I also noticed LightningCSS is a fantastic and blazing-fast tool, but sometimes stability and predictability take priority over pure performance. |
|
As the original bug said, this seems to have more to do with there being a visitor than the |
|
This still happens in a fresh instance of lightningcss as well. I would create a reproduction but I have limited connectivity for the time being. |
Why?
At Slack we use lightningcss for our CSS minification, but not for CSS modules. We have noticed lightningcss will wrap unknown pseudos with an
:is()selector which causes unnecessary invalidations in our app because CSS module processing comes later in our toolchain.What?
This pull request adds optional support for unknown pseudos to bypass lightningcss' modifications of selectors like
:globaland:localso that we can avoid the unnecessary CSS invalidation those additions cause.Notes
This is my first time contributing to this project and one of my first times working with Rust. I'm happy to field any suggestions or feedback you might have.