Skip to content
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

minifyJs turns single quotes in handler-attributes into double quotes #41

Open
Kreozot opened this issue Feb 22, 2017 · 4 comments
Open
Labels

Comments

@Kreozot
Copy link

Kreozot commented Feb 22, 2017

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.

@fstanis
Copy link
Contributor

fstanis commented Jan 7, 2019

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.

@maltsev
Copy link
Member

maltsev commented Jan 22, 2019

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.

@maltsev
Copy link
Member

maltsev commented Jan 22, 2019

And if someone is interested in fixing that bug I've added a failed test.

@maltsev maltsev added bug and removed help wanted labels Aug 8, 2020
@SukkaW
Copy link
Contributor

SukkaW commented Nov 18, 2020

@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:

posthtml/posthtml-render#47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants