5 ms·
>our minified HTML Unreadable source code is a crime against humanity.
by Dalewyn 3y ago
>our minified HTML
Unreadable source code is a crime against humanity.
- henriquez 3y agoIt’s also a crime against zorgons from Planet Zomblaki.
- hnick 3y agoIs minified "code" still "source code"? I think I'd say the source is the original implementation pre-minification. I hate it too when working out how something is done on a site, but I'm wondering where we fall on that technicality. Is the output of a pre-processor still considered source code even if it's not machine code? These are not important questions but now I'm wondering.
- Dalewyn 3y agoThe minified HTML (and, god forbid, JavaShit) is the source from which the browser ultimately renders a page, so yes that is source code.
- naniwaduni 3y ago"The ISA bytecode is the source from which the processor ultimately executes a program, so yes that is source code."
- hunter2_ 3y agoI suppose the difference is that someone debugging at that level will be offered some sort of "dump" command or similar, whereas someone debugging in a browser is offered a "View Source" command. It's just a matter of convention and expectation. If we wanted browsers to be fed code that for performance reasons isn't human-readable, web servers ought to serve something that's processed way more than just gzipped minification. It could be more like bytecode.
- panzi 3y agoIf you need to use prettiefy to even have a chance to understand the code, is it still source code? About the byte code: You mean wasm? (Guess that's what you're alluding to.)
- flusensieb 3y agoIf you need syntax highlighting and an easy way to navigate between files to understand a large code base, is it still source code?
- phatskat 3y ago> It could be more like bytecode. Isn’t this essential what WebAssembly is doing? I’ll admit I haven’t looked into it much, as I’m crap with C/++, though I’d like to try Rust. Having “near native” performance in a browser sounds nice, curious to see how far it’s come.
- Dalewyn 3y ago>If we wanted browsers to be fed code that for performance reasons isn't human-readable, Worth keeping in mind that "performance" here refers to saving bandwidth costs as the host. Every single unnecessary whitespace or character is a byte that didn't need to be uploaded, hence minify and save on that bandwidth and thus $$$$. The performance difference on the browser end between original and minified source code is negligible.
- hunter2_ 3y agoI was thinking transfer speed, although even then, the difference is probably negligible if compressing regardless.
- Dalewyn 3y agoThe way I see it, if someone needs to minify their JavaShit (and HTML?! CSS?!) to improve user download times, that download time was horseshit to start with and they need to rebuild everything properly from the ground up.
- regular_trash 3y agoTurrles all the way down
- gmerc 3y agoand does an LLM care … it feels like minification doesn’t stop one form explaining the code at all.
- throwaway290 3y agoSource code is what you write and read, but sometimes you write one thing and people can only read it after your pre processing. Why not enable pretty output? Plus I suspect minifying HTML or JS is often cargo cult (for small sites who are frying the wrong fish) or compensating for page bloat
- robertlagrant 3y agoIt does stuff like tree shaking as well; it's quite good. If your page is bloated, it makes it better. If your page is not bloated, it makes it better.
- throwaway290 3y agoTree-shaking is orthogonal to minification tho.
- robertlagrant 3y agoThat's true.
- dgb23 3y agoIt doesn't compensate bloat, but it reduces bytes sent over the wire, bytes cached in between and bytes parsed in your browser for _very_ little cost. You can always open dev tools in your browser and have an interactive, nicely formatted HTML tree there with a ton of inspection and manipulation features.
- throwaway290 3y agoIn my experience usually the bigger difference is made by not making it bloated in the first place... As well as progressive enhancement, nonblocking load, serving from a nearby geolocation etc. I see projects minify all the things by default while it should be literally the last measure with least impact on TTI
- vasco 3y agoNobody tell this guy about compilers.
- midoridensha 3y agoSo I guess you think compiled code is even worse, right?
- Dalewyn 3y agoI mean, isn't that precisely why open source advocates advocate for open source? Not to mention, there is no need to "minify" HTML, CSS, or JavaShit for a browser to render a page unlike compiled code which is more or less a necessity for such things.
- hunter2_ 3y agoIf someone releases only a minified version of their code, and licenses it as free as can be, is it open source?
- naniwaduni 3y agoThe popular licenses for which this is a design concern are careful to define source code to mean "preferred form of the work for making modifications" or similar.
- zauguin 3y agoAccording to the Open Source Definition of the OSI it's not: > The program must include source code [...] The source code must be the preferred form in which a programmer would modify the program. Deliberately obfuscated source code is not allowed. Intermediate forms such as the output of a preprocessor [...] are not allowed.
- midoridensha 3y agoMinifying code for browsers greatly reduces the amount of bandwidth needed to serve web traffic. There's a good reason it's done. By your logic, there's actually no reason to use compiled code at all, for almost anything above the kernel. We can just use Python to do everything, including run browsers, play video games, etc. Sure, it'll be dog-slow, but you seem to care more about reading the code than performance or any other consideration.
- SahAssar 3y agoMinifying HTML is basically just removing non-significant whitespace. Run it through a formatter and it will be readable. If you dislike unreadable source code I would assume you would object to minifying JS, in which case you should ask people to include sourcemaps instead of objecting to minification.