Add html/php minification

hi, i would like to add html/php minification to sage for higher google pagespeed rank. where will you advise me to start from?

HTML/PHP minification isn’t related to your WordPress theme. I’d advise you to start looking at plugins that accomplish what you want.

thank for your answer,

i am trying to avoid using plugin for this because they usually make other problems from my experience.

i kind of succeed to minify with grunt: grunt-contrib-htmlmin in a scratch theme i built.

i hoped maybe i could do it here too… but from my digging i didn’t find a gulp task that can handle php files so i pass for now…

thanks anyway

You could also use a CDN like Cloudflare to handle the minification.

You definitely don’t want to have something in your theme’s build script responsible for the HTML minification of your whole site.

do you think it will remove the error on pagespeed insight about html minification?

Considering they specifically offer HTML minification, I don’t see why not?

1 Like

thanks a lot, i will check it…

Old thread but still relevant, as CloudFlare minify no longer does much of anything.

If interested check out our new Minify HTML plugin for WordPress (works also with Sage theme):

Several defined constants to customize functionality, no settings/database.

Looking great, thanks jessuppi!

Purchase WP Rocket. Best one I’ve used and requires minimal configuration.

Thanks codepuncher,

Its really looks promising, I will recommend it to my client.