| ▲ | janilowski 2 days ago | ||||||||||||||||||||||||||||||||||||||||
It's very impractical. - you get a slower first load (cannot progressively fetch resources as they're needed) - can't reuse a stylesheet, script or image on a different page (each has to have their own copy) - can't cache commonly used files - can't make granular changes to specific parts of the code. user has to reload everything each time. - can't set a proper content security policy And many more! It's cool for a tiny demo but for anything serious you wouldn't want a single (extremely ugly) HTML file. | |||||||||||||||||||||||||||||||||||||||||
| ▲ | hnlmorg 2 days ago | parent | next [-] | ||||||||||||||||||||||||||||||||||||||||
I'm not advocating this development approach, but I also think some of your reasons aren't particularly robust when scrutinized. > can't reuse a stylesheet, script or image on a different page (each has to have their own copy) Isn't the point of a single HTML file that you don't have different pages that would need to reuse those assets? > can't cache commonly used files You can still cache the HTML. > can't make granular changes to specific parts of the code Pretty sure text editors can edit text regardless of whether it's a single file or multiple files. > can't set a proper content security policy I'd have thought a single page HTML file could negate the need for a CSP since you no longer have any resources accessible via a URI that you need to limit access to. > you wouldn't want a single (extremely ugly) HTML file Ugliness a subjective. --- I think your first load point is the strongest one. But I'd also throw in "it's harder to develop a good single page HTML" You could probably mitigate some of that difficulty by having a build script (like static site compilers) but then you have to ask yourself if you're introducing more complexity than you're attempting to solve. | |||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||
| ▲ | voidUpdate 2 days ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||||||||
> "can't reuse a stylesheet, script or image on a different page (each has to have their own copy)" Not a problem if you're deploying a single file | |||||||||||||||||||||||||||||||||||||||||
| ▲ | pepa65 2 days ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||||||||
This is an example of a single html-file that I serve: https://basketball.4e4.in It weighs in at around 30 KB including a favicon, and it's quite functional. | |||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||
| ▲ | tiborsaas 2 days ago | parent | prev [-] | ||||||||||||||||||||||||||||||||||||||||
In this case, it's 45kbyte over the network. Instead of very impractical, we might agree that it can be not ideal for many apps, but it's an interesting and valid way of "packaging" a tool / service. If someone chooses this deployment method, it's likely that they have the ability to design with minimal resources. | |||||||||||||||||||||||||||||||||||||||||