Stranger6667 / css-inline

High-performance library for inlining CSS into HTML 'style' attributes
https://css-inline.org/
MIT License
239 stars 29 forks source link

Consider lol-html instead of kuchiki #80

Closed Stranger6667 closed 2 years ago

Stranger6667 commented 4 years ago

https://github.com/cloudflare/lol-html

I have a PoC that is kinda working for a simple case but need some benchmarking, CSS parsing code is the same

Stranger6667 commented 4 years ago

With lol-html inlining is on average 2-2.5 faster, worth switching. Also with smallvec there are more optimizations possibilities

Stranger6667 commented 4 years ago

Possible issue - lol_html doesn't support pseudo-classes like a.bluelink:active . probably we can just remove pseudoclasses and de-duplicate selectors

Stranger6667 commented 2 years ago

Selectors support in lol-html differs from cssparser significantly, so it boils down to extra performance vs correctness. Being already fast enough, and faster than alternatives (not in Rust, but e.g. CLI tools), I think it is better to keep the implementation based on cssparser.