-
Notifications
You must be signed in to change notification settings - Fork 36
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
minify-html does not respect whitespaces in <pre> #21
Comments
I think this is due to the context-aware minification being reset when there's a child element within a <pre><code>fn main() {
println!("Hello, world!");
loop {
println!("Hello, world!");
}
}
</code></pre>
<pre><code>fn main() {
println!("Hello, world!");
<span>loop {
println!("Hello, world!");
}</span>
}
</code></pre> Is converted into this minified HTML: <pre><code>fn main() {
println!("Hello, world!");
loop {
println!("Hello, world!");
}
}
</code></pre><pre><code>fn main() {
println!("Hello, world!");
<span>loop { println!("Hello, world!"); }</span>
}
</code></pre> The two code blocks are the same, except the second has a |
Thanks for raising, I've updated the code to use <pre><code>fn main() {
println!("Hello, world!");
loop {
println!("Hello, world!");
}
}
</code></pre><pre><code>fn main() {
println!("Hello, world!");
<span>loop {
println!("Hello, world!");
}</span>
}
</code></pre> |
* Update minify-html dependency to version 0.4.2 Fixes #1300. See also wilsonzlin/minify-html#21 * Update minify-html dependency in Cargo.lock * Add test to check pre whitespace isn't collapsed
For example:
After
./target/debug/minify-html-cli --src test.html -o out.html
:minify-html should not touch any whitespace inside
<pre>
since it's already formatted.The text was updated successfully, but these errors were encountered: