kirby-deprecated-plugins / kirby-html-minifier

Minify the html output of a site built with Kirby CMS
MIT License
21 stars 1 forks source link

Missing javascript conditions due to compression #13

Open grommas opened 6 years ago

grommas commented 6 years ago

I have a (pre-)compressed script in my header. When using your plugin, it deletes one of two conditions.

original: <script>!function(s,t){var e=document.documentElement,n=(new Date).getHours();e.classList.remove("no-js"),n>20||n<8?e.classList.add("day"):e.classList.add("night")}(window,document);</script>

compressed: <script>!function(s,t){var e=document.documentElement,n=(new Date).getHours();e.classList.remove("no-js"),n<8?e.classList.add("day"):e.classList.add("night")}(window,document);</script>

I was wondering why? Thanks in advance! Cheers, Jakob

jenstornell commented 6 years ago

It's because you have < and > in your inline script. I will try to find a fix but I can't say when. In the meantime, maybe you can move the inline js into your a js file?