-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add Rust-based transformer/packager/optimizer for HTML and SVG #10090
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
Conversation
# Conflicts: # packages/configs/default/package.json # packages/core/integration-tests/test/html.js # packages/packagers/html/package.json # packages/packagers/svg/package.json # packages/transformers/html/package.json # packages/transformers/svg/package.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm currently working on copying the arenas you have here into oxvg. I've raised a draft in case you have any particulars you'd like to comment in.
noahbald/oxvg#123
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! I did end up needing to duplicate a bunch of that still unfortunately. I need to store a few other things in the AST, namely line numbers, and some HTML-specific things. Not sure there's a way to avoid that though.
# Conflicts: # packages/configs/default/package.json # packages/packagers/html/package.json # packages/packagers/svg/package.json # packages/transformers/html/package.json # packages/transformers/svg/package.json
# Conflicts: # Cargo.lock # packages/transformers/js/core/Cargo.toml
Closes #10080, closes #10135
This replaces the posthtml-based transformer/packager/optimizer with a Rust-based one powered by html5ever, the HTML parser from Servo. For SVG optimization, it uses oxvg, an SVGO replacement written in Rust which uses Lightning CSS for CSS optimization.
Aside from being faster, this also reduces the number of npm dependencies to install, some of which haven't been maintained very much over the last few years.