Why is Minify Html off by default?

husseycoding

Free Member
Sep 10, 2012
26
3
In some (admittedly pretty rare) cases minification can result in invalid code which in the case of HTML would essentially break the store frontend. I would imagine it's disabled as Magento couldn't guarantee it to be 100% error free when it comes to the addition of third party module code, so they supply the tool, but enabling it is at the store owners risk. Basically enable it, then have a good browse of the store to check that all still looks good!
 
  • Like
Reactions: Raw Rob
Upvote 0

fisicx

Moderator
Sep 12, 2006
46,731
8
15,397
Aldershot
www.aerin.co.uk
It slows down a site increasing TTFB (time to first byte).
Do you mean minification is dynamic? That it takes place as the page is requested?
 
Upvote 0

goivvy

Free Member
  • Business Listing
    Nov 29, 2016
    108
    25
    www.goivvy.com
    Do you mean minification is dynamic? That it takes place as the page is requested?

    Well, untill a page is full page cached it does take CPU cycles to turn HTML into compressed HTML thus an increase in TTFB.

    For pages like cart/checkout/customer area (which are not full page cached) an increase will be there on every page request.
     
    Upvote 0
    It's also easier to work with properly formatted html in the development phase. As soon as the site is live, enable it and test.
    I suspect this is a large part of the reasoning behind keeping minification off by default. It's near-impossible to customise and edit HTML that's been minified; you spend more time trying to work out where one line begins and another ends than you do making any progress development-wise.
     
    Upvote 0

    goivvy

    Free Member
  • Business Listing
    Nov 29, 2016
    108
    25
    www.goivvy.com
    I suspect this is a large part of the reasoning behind keeping minification off by default. It's near-impossible to customise and edit HTML that's been minified; you spend more time trying to work out where one line begins and another ends than you do making any progress development-wise.
    I highly doubt that.

    Chrome dev tools source editor formats your HTML regardless of whether it's minified or not. The other browser HTML inspect tools do the same.
     
    Upvote 0
    I highly doubt that.

    Chrome dev tools source editor formats your HTML regardless of whether it's minified or not. The other browser HTML inspect tools do the same.
    Interesting - I wasn't aware the browser dev tools had this functionality. I see you offer a Magento development service so I dare say you're more informed on the subject than I am. Slightly off-topic but is it standard practice to develop using the built in browser tools? Most of my development takes place in desktop text editors so it'd be interesting to see how the pros do it.
     
    Upvote 0

    Sagar Nayyar

    Free Member
    May 7, 2019
    6
    2
    It is similar to merging / bundling, minifying of JS and CSS are off by default. It is better to test your site with everything off to find the root cause of performance issues instead of turning everything on and never spot performance issue during development. It also makes debugging easier for developers by keeping everything off by default hence Magento 2 has develop and production mode.
     
    Upvote 0

    Latest Articles