Swaagie / minimize

Minimize HTML
MIT License
163 stars 18 forks source link

Apostrophes in attributes #40

Closed toliklunev closed 9 years ago

toliklunev commented 9 years ago

Attribute <div data-vars='{"form": "blablabla"}'></div> after processing will come to <div data-vars="{"form": "blablabla"}"></div>

Swaagie commented 9 years ago

Currently this is not supported, since htmlparser2 will just parse out the content of the attribute and minimize reconstructs each attribute through https://github.com/Moveo/minimize/blob/master/lib/helpers.js#L72-L74, would an quoting style option be sufficient in this case? e.g. new Minimize({ quotemarks: "'" }) where " is default and it can be optional set to '

Swaagie commented 9 years ago

Hmm perhaps a options named singlequote would make more sense, e.g. new Minimize({ singlequote: true }) which would use a ' style

toliklunev commented 9 years ago

I'm think second embodiment have more sense.

toliklunev commented 9 years ago

Or can do a background check on the content attribute presence "

Swaagie commented 9 years ago

Good last call, will do that :) expect a patch release today