News for hackers. Stuff that matters.
Re:Entire website in a single HTML file by gigel82 on Thursday December 23, 2021 @08:02PM (#29668673)
How is this news? React SPAs have been around for years, and SPAs existed long before React too.
Re:Entire website in a single HTML file by Dma54rhs on Thursday December 23, 2021 @08:26PM (#29668900)
This thing is fast unlike anything built as a spa nowadays that make your laptops fan spin so fast it wants to take off.
Re:Entire website in a single HTML file by LAC-Tech on Thursday December 23, 2021 @09:16PM (#29669246)
It's fully possible to build fast SPAs.

Though almost no one is able to do it.

Which is weird, as it's objectively easier than writing enterprise react crap.

Re:Entire website in a single HTML file by jolmg on Thursday December 23, 2021 @08:05PM (#29668707)
The difference compared to SPAs is that this doesn't use javascript.
Re:Entire website in a single HTML file by dredmorbius on Thursday December 23, 2021 @11:23PM (#29670168)
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 by gigel82 on Friday December 24, 2021 @02:18AM (#29671188)
I've built React SPAs with inlined JS, CSS and SVGs in 2017, which is why I'm still entirely clueless what's special about this.

BTW, the discussed page is not at all a single-page site; it makes separate network requests for CSS and PNG files.

Re:Entire website in a single HTML file by dredmorbius on Friday December 24, 2021 @04:05AM (#29671816)
The point of this demonstration is that single-file provisioning is specifically the point. And specifically, using only HTML and CSS.

The concept of an "SPA" refers to the appearance rather than provisioning of the app, and inherently relies on Javascript (or an equivalent scripting capability) to interactively rewrite the display. It's possible to single-file an SPA. The characteristic isn't central to the SPA concept, and in practice implementation is typically anything but.

SPAs are not accessible without Javascript, and don't render at all from a terminnal / console-mode browser. (Ask me how I know this...)

This is not an app. It's a website, or at least, multiple web pages, provisioned from a single HTML file.

Yes, this instance has several external references. I've noted CSS in an earlier comment, you mention image assets. The concept could be further optimised for portability by incorporating those inline.

Note that optimisations are also trade-offs. Inlined assets would mean duplication for a larger site. Which of those trade-offs are preferable or unwanted really depends on the specific goals.

But as a demonstration of an idea, this really is pretty elegant.

Re:Entire website in a single HTML file by kome on Friday December 24, 2021 @04:36AM (#29672052)
yeah, but you missed the point.
Re:Entire website in a single HTML file by jcpst on Thursday December 23, 2021 @08:51PM (#29669063)
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.

Re:Entire website in a single HTML file by dredmorbius on Thursday December 23, 2021 @11:26PM (#29670188)
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 by jcpst on Saturday December 25, 2021 @07:52PM (#29688579)
MP-SFS
Re:Entire website in a single HTML file by xwdv on Thursday December 23, 2021 @09:17PM (#29669251)
But what is the benefit?
Re:Entire website in a single HTML file by jcpst on Thursday December 23, 2021 @11:21PM (#29670150)
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 by xwdv on Friday December 24, 2021 @11:12AM (#29674736)
But what benefit is there for the end user?
Re:Entire website in a single HTML file by jcpst on Monday December 27, 2021 @09:08PM (#29709515)
Source code that is readable. Viewing the source on web pages in the 90s was how I learned to make my first web pages.
Re:Entire website in a single HTML file by est on Thursday December 23, 2021 @09:26PM (#29669313)
less Co2 emissions
Re:Entire website in a single HTML file by TrevorAustin on Thursday December 23, 2021 @08:24PM (#29668877)
Also, those SPAs are loading the React literary off of a CDN. It’s not inlined into the page.
Re:Entire website in a single HTML file by gigel82 on Friday December 24, 2021 @02:14AM (#29671158)
I have definitely built React SPAs with inlined JS and CSS as far back as 5 years ago, it even inlined some SVGs for icons; it was literally a single HTML page (unlike the discussed page, BTW, which loads the CSS and the images with separate network requests).