-
Notifications
You must be signed in to change notification settings - Fork 8
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
Converter minifier / optimizations overlap #37
Comments
Fully agree. It would be good if we can remove the |
Re. |
On second thought I think it'd be fine to keep the option to skip optimizations. It's not that hard to thread things through to have it working properly again, and it could prove to be a useful toggle for fuzzing to ensure that that the minified output is semantically equivalent to the full output Applying optimizations without using regexes I'm still 100% on-board with. It'll just be a bit before I have spare time to work on it |
Currently some converter optimizations are always applied through a minifier on the parsed representation that discards duplicate styles from being applied
to-html/crates/ansi-to-html/src/html/mod.rs
Lines 52 to 57 in 114efd8
While even more are applied through two regexes on the converted text where the first removes empty tags and the second removes the reapplication of the same tag
to-html/crates/ansi-to-html/src/lib.rs
Lines 188 to 189 in 114efd8
Three different things of note...
If we teach the minifier how to remove empty tags then it should apply all of the optimizations that the regexes apply (technically it could be even better since the regexes only apply once despite being able to optimize further after the first pass)
Well the fact that the minifier currently always applies some optimizations makes
Converter::skip_optimize
into only a half-truth. Really we should only apply the minifier when optimizations are enabled, but considering that no one has complained maybe it's a good sign to enable optimizations by default or always enable optimizations (removing the toggle)If the minifer took the place of both of the optimization regexes then
ansi-to-html
would be down to just one regex usage (ANSI_REGEX
)to-html/crates/ansi-to-html/src/lib.rs
Line 187 in 114efd8
which is normally my hint to re-evaluate if regex is carrying its weight as a dependency or if it can be replaced with some simpler parser instead of the (relatively heavy)
regex
crateThe text was updated successfully, but these errors were encountered: