dciccale / grunt-processhtml

Process html files at build time to modify them depending on the release environment
MIT License
407 stars 30 forks source link

Oneline HTML produces empty HTML #108

Closed sake92 closed 7 years ago

sake92 commented 7 years ago

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?

G1itcher commented 7 years ago

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.

dciccale commented 7 years ago

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 https://github.com/dciccale/node-htmlprocessor/pull/27