jonkemp / inline-css

Inline css into an html file.
MIT License
429 stars 84 forks source link

Self-closing html tags get change #73

Open lucastobrazil opened 6 years ago

lucastobrazil commented 6 years ago

Hi there,

We're using Apache Wicket for sending our emails and using inline-css as a gulp task to inline the styling. We we are running into some issues where the task is not handling self-closing tags very well.

<base wicket:id="base" /> becomes <base wicket:id="base">

And then <wicket:child /> becomes:

<wicket:child></wicket:child>

Is it possible that the task does not handle self-closing tags correctly?

Thanks :)

jonkemp commented 6 years ago

@lucastobrazil inline-css uses cheerio to do the html parsing, and cheerio uses another module called htmlparser2. If the issue is the XML being mangled then I would look there. htmlparser2 says it can handle XML.

https://github.com/cheeriojs/cheerio https://github.com/fb55/htmlparser2/

There's a set of options that gets passed to cheerio from inline-css. I believe xmlmode is set to false. You can try overriding that in the options and see if that fixes it.

lucastobrazil commented 6 years ago

@jonkemp oh awesome, thanks! Will look into it and report back :)