htmlnano
htmlnano copied to clipboard
minifyJs turns single quotes in handler-attributes into double quotes
Which is breaking code, of course.
Here is the case: <a onclick="myFunc('my string')">
turning into <a onclick="myFunc("my string")">
. When I disable minifyJs option, everything is fine.
This might be fixable by simply specifying minifyJs: { quote_style: 1 }
. I can't currently test, but writing this if someone else has some time.
Sorry, @Kreozot, I still don't know how to fix that without adding too many hacks :-/
You could use the following config to fix your particular case:
minifyJs: {
output: { quote_style: 1 },
},
I've added it to the documentation as well.
And if someone is interested in fixing that bug I've added a failed test.
@maltsev
The quote style is determined by posthtml-render
's option.
It is possible for htmlnano to override terser
's quote_style
based on posthtml
's option.
Update
I have opened a PR at posthtml-render
:
https://github.com/posthtml/posthtml-render/pull/47