96

I'll never again compress my HTML, such a spagetti!

Comments
  • 37
    I saw a rant months ago about someone having a classmate that went in and properly formatted a compressed bootstrap file. Only to be told the properly formatted one already exists lol
  • 5
    @jhh2450 did he do it by hand? ;D
  • 8
    @BambuSource Do believe so. Was trying to find it, but after several minutes of scrolling I had only reached October's rants I liked. 😂😂😬
  • 10
    Why on earth would you compress html?
  • 12
    You can just beautify it again - search for the plugin and also theres scripts that minify it for you before deploying it, webpack, cloudflare, ..
  • 9
    @HalfBloodPrince to save bandwidth and how much a browser has to load, its also common to bundle everything together via deploy scripts, so only one file gets loaded. (inline css, inline js, inline images ..)
  • 11
    That's why you have your source code and then let webpack / Babel build it to a separate file for you.
  • 1
    Hahaha
  • 2
    @JoshBent or you could use HTTP/2 and download everything in one request, even if they are in separate files.
  • 3
    @aritzh Sure, but the compression should still save the bandwidth?
  • 1
    I actually used a prettifyer before but it removed unknown attributes and stuff (like <div speed="5"> for my parallax) and @Dacexi yes I know there are more effective ways but I directly work with my final code.
  • 1
    You can also format it on chrome
  • 0
    @hubiruchi i know - pretty print sounds so sweet
  • 3
    @jhh2450 last week I used hover css in one of my webpage. My WD friend had told me to use min files so I picked the min version of the css which came to be compressed like this. I formatted the required portion only to find it already formatted in the normal version. :\
  • 5
    @sambhav2612 I've been there, too and I felt pretty dumb afterwards. Next level is your colleague editing the minified file and not telling you so that you overwrite his changes with automated minification.
  • 1
    @Alkotronikk oh yeah, it will, but you wouldn't need to put all the CSS/JS/other in the same file. And I'd guess that you'd save more bamdwidth by using HTTP compression, rather than removing extra whitespaces. (Obviously, the best would be Compressed HTTP/2 with uglified files)
  • 1
    @BambuSource what you mean is something different, the thing mentioned only formats it, just like an IDE does, nothing else.
  • 2
    @aritzh iirc google will bitch at you for any external resources nowadays also, so packaging solves that too.

    Theres a ton of reasons why to package, rather than not to, so I see no reason why one shouldn't.

    Especially when one pays for bandwidth (ex. AWS) and will save a shit ton by just delivering less.
  • 2
    @aritzh less - in the meaning of useless readability aid, since theres no need to have non minified code, since if somebody opens up the devtools he will anyway see a beautified version of the source.
  • 1
    @BambuSource I told you that it was a bad idea 😝
  • 1
    @JoshBent of course, I just meant that (just a guess) a user would load a website faster if the server used HTTP/2 and compression, instead of just minifying the files, or even joining them in one. However, the best would still be to apply all of them together, although you would lose from mantainability (unless the minifying is automated). And in the case that you pay for used bandwidth, then of course minifying would be better than HTTP/2. However, in general, I'd say that using HTTP compression would be even more effective in saving bandwidth.
  • 2
    Compressed stuff isn't really spaghetti code
  • 1
    You can prettify html, js, CSS, and even yourself 😎
  • 1
    @ribchinski why do you ever need compress Java?💩
  • 1
    @DefiniteGoose chrome has build in prettify 😎 morden just bundle could easily go over 10mb without compress
  • 1
    @jhh2450
    Open vsc
    CMD shift p
    Beautify

    Profit
Add Comment