You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since everything is inlined, classes are useless and likely won't bring any benefits but occupy some space in the output. Hence I believe we can safely remove them.
Implementation
Add the keep_classes configuration option (everywhere, including CLI and all bindings). The default should be false.
Pass this config option down to the serializer and check it before writing classes to the output buffer here.
The text was updated successfully, but these errors were encountered:
Hi there, would it be feasible to just remove the selectors that have been successfully inlined instead? From both the CSS and the HTML class attrs - ideally you'd only want to purge selectors that you know have been inlined and are no longer needed.
This would solve a massive paint point for us in Maizzle too (selector matching and purging is limited by PostHTML capabilities, so we can't inline or remove some more complex selectors) and I think we could switch over from Juice 🙈
I think it is feasible + #265 notes a similar idea of keeping some subset of the original CSS.
The implementation does not look too complex - in this block, it is possible to track what selectors are applied and build a new CSS buffer from selectors without matches. I'm not sure if splitting those by the original source (right now it is an optimization to minimize allocations), but it could also be done. And some config option to enable this behavior will be also nice to have. I don't have much capacity to work on this myself right now, but will be happy to review a PR and provide any guidance needed.
P.S. Please, let me know if there is anything else that is missing in css-inline, so you can benefit from it :)
Problem
Since everything is inlined, classes are useless and likely won't bring any benefits but occupy some space in the output. Hence I believe we can safely remove them.
Implementation
keep_classes
configuration option (everywhere, including CLI and all bindings). The default should befalse
.The text was updated successfully, but these errors were encountered: