Live data from Hacker News

Entire website in a single HTML file

css-tricks.com

101–110 of 333 posts

Re: Entire website in a single HTML file

#101
post #84

HTML and CSS alone are really powerful. I decided not to use any JS on my personal site, but you can still have: + collapsible sections with `details` and `summary`[0] + footnotes, with navigation to/from with anchor tags. You can even apply CSS on the currently selected footnote.[1] + Semantic web that is compatible with everything and has sensible defaults so you can focus on what you're actually doing! + Tiny depl…

nice. most sites that use javascript don't need to... https://i.imgur.com/qaJYWit.png

Re: Entire website in a single HTML file

#102
post #27
post #19

Earlier quoted context omitted.

No, not a SPA. There is a concept of a single file app (SFA). You can share an html file, and that is the application. It can have inlined micro js/css frameworks, or hand-rolled everything. An SFA should be human readable though- viewing the page source is useful. I think it’s a concept worth exploring.

But what is the benefit?

Showing the capabilities of the web browser as an application target, directly. You have HTML, CSS, and JS available.

No build tools required. Take this file and open it with a web browser. Then modify it, and refresh the browser.

Distribution and Development for applications is about as straightforward and accessible as it gets.

Re: Entire website in a single HTML file

#103
post #3

How is this news? React SPAs have been around for years, and SPAs existed long before React too.

SPAs display in a single HTML URL, but are themselves (typically) comprised of multiple elements, including many CSS, JS, and data elements which are fetched dynamically.

The example URL is a complete website within a single HTML document with no external dependencies and no further round-trip requests. It is a single-page site (SPS) or perhaps a multi-page file (MPF).

https://john-doe.neocities.org/

You can open that URL, disable networking, and browse the entire site to your heart's content in any browser supporting CSS.

If you open the file in a terminal browser (lynx, w3m, elinks[2], etc.), you'll see the full site presented at once, as a single page, without needing to specifically navigate between them (you can scroll the full site). Though the intra-site navigation itself still works --- it just doesn't reveal or hide sections.

Re: Entire website in a single HTML file

#105

The trick is kinda meh I feel. Yes you can make a pretty cool app in a single HTML file with some inline JavaScript to boot. Still possible today just ever more out of fashion

No JS here though, just CSS using :target. That's pretty cool if you don't want a JS dependency but want more control over interactivity and presentation.

Not to get too dramatic about this, but if you're that scared of any JS, why are you using the internet?

Re: Entire website in a single HTML file

#106
post #19
post #3

How is this news? React SPAs have been around for years, and SPAs existed long before React too.

No, not a SPA. There is a concept of a single file app (SFA). You can share an html file, and that is the application. It can have inlined micro js/css frameworks, or hand-rolled everything. An SFA should be human readable though- viewing the page source is useful. I think it’s a concept worth exploring.

I prefer the denotation of a single file site (SFS). Perhaps alternatively a multi-paged file (MPF), as there might still be multiple such pages on a site, or a site comprised of a mix of MPFs, SPAs, and traditional static single-page URLs.

Re: Entire website in a single HTML file

#107

Earlier quoted context omitted.

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.

This is categorically false.

There have always been other tools for producing PDF (E.g. TeX) and there are also tons of free converters, print-to-PDF drivers, etc.

Re: Entire website in a single HTML file

#108

Earlier quoted context omitted.

Keep in mind that single integrated book formats are highly viable now. It's in the interest of publishers not to offer them, however. A chief example that comes to mind is the Feynman Lectures in Physics series, which are available online but only in a chapter-by-chapter basis in HTML format. (Quite beautifully formatted, FWIW.) If you want to glue those together into a single integrated whole, you'll have to do tha…

It makes sense from a DRM standpoint - PDFs and ePub are easy to crack if you offer it at all, so the only way to fix this is to go web-only and assume nobody will want to dig into turning that into a sharable PDF. Bonus points if you make it a SaaS test platform and get universities to buy into it, forcing every student to purchase the 'book' to receive grades.

The multi-page format makes access all the more inconvenient.

Copyright status means that anyone who glues together the set will find themselves pursued for infringement.

In practice, the question's moot as the Feynman Lectures are available via LibGen, ZLib, and similar resources.

Re: Entire website in a single HTML file

#109

Earlier quoted context omitted.

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?

[deleted]

Re: Entire website in a single HTML file

#110
Why the fuck is this top of HN.

I'm picturing way to many people viewing this today and thinking "Wow! Websites can be made without React? I will upvote!"

Are we at a point where university Web101 classes just jump straight into SPAs?

Post reply on HN