jonkemp / gulp-inline-css

Inline linked css in an html file. Useful for emails.
MIT License
272 stars 29 forks source link

Changing `<img>` element closing? #28

Open sgarbesi opened 8 years ago

sgarbesi commented 8 years ago

This plugin converts this:

<img src="..." />

To This:

<img src="...">

This is invalid markup, and while I'm sure many of the new browsers/renderers will not have a problem with this, I fear that the legacy browsers/renderers (Microsoft Outlook cough) will.

jonkemp commented 8 years ago

This is valid in HTML5.

sgarbesi commented 8 years ago

@jonkemp It's going to cause problems with the old renderers which I believe this plugin is geared towards? I'm sure in newer HTML renderers one can simply use a stylesheet via the link tag and not need to bother with inline styles. Defeats the purpose?

jonkemp commented 8 years ago

This module uses inline-css which uses cheerio, rather than juice which used jsdom. Apparently juice has an option to support closing tags now. Cheerio uses htmlparser2 which looks like it has an option to support this.

https://github.com/fb55/htmlparser2/wiki/Parser-options

I don't have plans to at this time though. I've had only a few requests for this. I would be interested in pull requests. Otherwise this could be something to look at doing at some point. I'll mark it as a feature request. Thanks.

sgarbesi commented 8 years ago

https://github.com/cheeriojs/cheerio/issues/378

sgarbesi commented 8 years ago

@jonkemp If I change L164 in inline-css.js to .xml() it fixes it.

sgarbesi commented 8 years ago

@jonkemp I submitted a PR.

drKnoxy commented 8 years ago

well this was surprising