dciccale/grunt-processhtml

Oneline HTML produces empty HTML

sake92 opened this issue · 2 comments

When the HTML file is minified, no spacing between tags:

<!DOCTYPE html><html lang="bs"><head title="Home Page"><meta charset="utf-8" /><!-- build:css css/tidy.css --><link rel="stylesheet" href="lib\bootswatch-cyborg\css\bootstrap.min.css" /><link rel="stylesheet" href="css\main.css" /><!-- /build --></head><body><div>My Body</div></body></html>

then I get the following output in my dist folder:

<link rel="stylesheet" href="css/tidy.css"/>

However, if the HTML is pretty-printed, everything is fine...
Is this the intended behavior?

Would like to see this fix implemented. As a result of it not playing nice with one-line html, this means it doesn't play nice with the standard Pug grunt settings; pretty must be turned on in order to result in a valid result.

Hi, you should process the html before minification. parsing one-liners is really really tricky in html and is not supported for now.

I've tried this in the past and failed, and now I have no much time to try it again. if you wish to contribute you could do a pull request to the processor http://github.com/dciccale/node-htmlprocessor

We could keep the conversation over that repo. here dciccale/node-htmlprocessor#27