HTML Minification

So I believe I am using this as the plugin - https://github.com/iksi/kirby-compress

This leaves whitespace inside the style and script tags which I am not after. Does anyone know of a minification plugin that will pass the inline JS through uglify or something similar, or even just a plugin that gets rid of the whitespace between the two tags mentioned?

If there’s only whitespace in those 2 tags, I’m not sure if that matters so much?

Anyway, you can try this PHP minify library, if it suits your needs. I tend to believe that this extra PHP function will hurt performance more then benefit from it.

If I misunderstood, and you were talking about what’s inside external CSS & JS files, you should really consider adding this into your build workflow instead of doing this on-the-fly on the webserver for each request.

Try taking the word script out of lines 25 & 30 of lib/response.php of the kirby compress plugin. That should include script tags in the minification, from what i can see, however there is probably a valid reason it doesn’t clean up the script tags. Perhaps it is known to break certain javascript. Your mileage may vary.

Another alternative plugin.

… which doesn’t work properly, see here :mask:

Works ok for me. What are your server specs? Im running Centos 7 and PHP 7, @jenstornell plugin works great for me. i don’t have any SVG tags on my page though.

Thank you all.

@jimbobrjames - I guess I should have had a look through myself to spot that blacklist haha. With regards to why it might be left out. It’s because I’m guessing a lot of devs might not close all JS tags. Yes you don’t have to, but when it comes to something like this closing those if statements explicitly will mean that it doesn’t through errors.

if {
  bla bla
} else {
  bla bla
}

VS

if {
  bla bla
} else {
  bla bla
};

So I am happy with how the compress works after removing style & script from the blacklist.