Laravel: Minify HTML

Assalamualiakum / Hi,

Just a quick blog post this time.

As part of optimisation, it’s important to minify your JavaScript & CSS – this can be done with Laravel Mix.

But how about HTML?

Seen this?

Ugly HTML Codes

So that’s how it’s look like our generated HTML codes.

And how we going to change into this?

Minified HTML Codes

A simple middleware will do to minify our HTML.

Then register the middleware and you are good to go!

Just grab this the Laravel Page Speed, then you’re done!


5 thoughts on “Laravel: Minify HTML

    1. Sama-sama pak Nafies.

      Ini salah satu cara untuk optimise HTML codes.

      Selalunya kita minify JavaScript dan CSS, tapi sebenarnya kita juga perlu minify HTML codes.

Leave a Reply

Your email address will not be published. Required fields are marked *

sixteen − 15 =