Live data from Hacker News

Entire website in a single HTML file

css-tricks.com

61–70 of 333 posts

Re: Entire website in a single HTML file

#61
post #35
post #31

Earlier quoted context omitted.

I wouldn't call that a limitation. In fact that is one of the major selling points of the PDF format. The document looks as intended* by the creator on all platforms whether display or print media. * Yes, I know, PDF doesn't -always- do this, but a well designed PDF generally does.

It is a limitation. Anyone who's ever tried to read a PDF journal article on their phone has experienced it. (and don't even get me started on Unicode copy/paste...) HTML can be styled in a fixed layout if desired, and reflowed by a reader mode if needed. PDF can't be styled in a responsive way, and there's no (easily accessible) reader mode equivalent for PDFs. HTML is a far better document format than PDF.

A significant advantage of the two column journal format (although still they end up feeling pretty clunky on a phone).

Re: Entire website in a single HTML file

#62
post #8

This is something I've always wanted for virtual textbooks. A single .html file with all the JS, CSS, images as inline data blobs, etc. For most physics, math, CS, etc books, this should be possible. It would make it trivial to download the book for offline use and share it with others. Other than the raster images, the entire content of these types of books would probably fit in a couple MB of text. The use of #anch…

You're describing PDF files, but unfortunately Adobe didn't invest much time or money into making them interactive with a scripting language.

Think about how much worse PDF exploits would be if they did!

Re: Entire website in a single HTML file

#63
post #5

Normal websites used to be one file way back in the day. It was a "pro tip" to split out the JS & CSS into a separate files.

Put your script tags at the bottom of the html page so that when the JavaScript is executed all the dom elements on the page can be referenced. Either that or bootstrap in a window onload callback. I remember picking up and being in awe of secrets of the JavaScript ninja

Here's an even bigger secret, if you're doing server-side rendering, putting things on top might actually be better.

You're maybe parallelizing things. As the client is downloading and interpreting the css and JavaScript, the server is doing database calls and rendering the HTML.

So you actually are doing things on the server side when you're "blocking"on the client. You didn't get this for free. You had to worry about buffers, flushing, and plenty of testing.

I don't know if you can still squeak an actual speed up with this technique (there's many attributes you can use to customize things these days) but I used to use it all the time back in the days of platter drives.

Re: Entire website in a single HTML file

#64
post #8

This is something I've always wanted for virtual textbooks. A single .html file with all the JS, CSS, images as inline data blobs, etc. For most physics, math, CS, etc books, this should be possible. It would make it trivial to download the book for offline use and share it with others. Other than the raster images, the entire content of these types of books would probably fit in a couple MB of text. The use of #anch…

You're describing PDF files, but unfortunately Adobe didn't invest much time or money into making them interactive with a scripting language.

The problem with PDF's has always been the layman can't create them without some expensive Adobe program.

Re: Entire website in a single HTML file

#65
post #41

This looks like one of those sites I made as a kid. What is the significance of this?

Nobody else is really doing this, or was doing this. But you can't tell that it's different, that's what's neat about it. It works just like a multi-page site but there's not even any JS requirement.

A decade ago we have this niche vBulletin forum where members would self-publish news article regarding the hobby. vBulletin BBCode is pretty limited, but then the admin started to add more and more styling support via custom BBCode.

At one point we were able to create "interactive" content entirely in our heavily customized BBCode without a single line of JS, and this #target is one of the more used tricks.

Re: Entire website in a single HTML file

#66
post #8

This is something I've always wanted for virtual textbooks. A single .html file with all the JS, CSS, images as inline data blobs, etc. For most physics, math, CS, etc books, this should be possible. It would make it trivial to download the book for offline use and share it with others. Other than the raster images, the entire content of these types of books would probably fit in a couple MB of text. The use of #anch…

I think you've just described an EPUB?

Re: Entire website in a single HTML file

#67
post #41

This looks like one of those sites I made as a kid. What is the significance of this?

Nobody else is really doing this, or was doing this. But you can't tell that it's different, that's what's neat about it. It works just like a multi-page site but there's not even any JS requirement.

Been doing this for over half a decade off of a template I boosted 8 years ago and have been modifying since.

Has made tens of millions in revenue.

Just assumed every developer or template seller in south asia was using this - or their clients. Probably more common than you think.

Re: Entire website in a single HTML file

#68
post #5

Normal websites used to be one file way back in the day. It was a "pro tip" to split out the JS & CSS into a separate files.

Hum... You may be thinking about a page being a file. A site is a collection of those.

A site is a website is the thing behind a domain name. Many were, and are, a single file. Its the rest of ya'll that are overcomplicating things and somehow perverted that to thinking its necessary. How many layers of meta are we right now for this article to be interesting?

Re: Entire website in a single HTML file

#69

Earlier quoted context omitted.

Nobody else is really doing this, or was doing this. But you can't tell that it's different, that's what's neat about it. It works just like a multi-page site but there's not even any JS requirement.

Been doing this for over half a decade off of a template I boosted 8 years ago and have been modifying since. Has made tens of millions in revenue. Just assumed every developer or template seller in south asia was using this - or their clients. Probably more common than you think.

So you are using a single HTML file with no JS at all to deliver a multi-page site? Just to be clear.

Re: Entire website in a single HTML file

#70

Man, I'm old.

right? everyone is fawning over this basic html as if its this amazing trick, the foreshadowing was the people pointing out how progressive web apps aren't necessary for most use cases, but now I really see I can't trust anybody's opinion here because this is normie levels of perception at this point.
Post reply on HN