kirby-html-minifier icon indicating copy to clipboard operation
kirby-html-minifier copied to clipboard

Missing javascript conditions due to compression

Open grommas opened this issue 6 years ago • 1 comments

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

grommas avatar Jun 05 '18 16:06 grommas

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?

jenstornell avatar Aug 07 '18 12:08 jenstornell