Nasrul Hazim Bin Mohamad

Laravel: Minify HTML

Feb
25

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!

Thanks,
Nasrul

3 Responses to Laravel: Minify HTML

  1. Nice Share pak Nasrul, baru tahu ada yang seperti ini. Terima kasih.

    • 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 *

fourteen − 3 =