Live data from Hacker News

Entire website in a single HTML file

css-tricks.com

311–320 of 333 posts

Re: Entire website in a single HTML file

#311

Lovely article and such an interesting way of creating single page apps. I never knew about this usage of the :target selector. I think a major issue with this approach is just practicability - I'd want to write my content in something like markdown and we will anyway need JS to convert the markdown to HTML. I have also been interested in making SPAs, my my way is more traditional. Using javascript for the stitching.…

> we will anyway need JS to convert the markdown to HTML.

You could compile the markdown to HTML server-side …

Re: Entire website in a single HTML file

#312
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…

And images can be also embedded. These days you can fake a real URL completely on a fronted side.

What do you mean by faking a real URL on frontend side? I'm genuinely interested.

Re: Entire website in a single HTML file

#313
post #308

Earlier quoted context omitted.

> So forget e-commerce? Says (s)he and immediately follows up with > Amazon didn't do too badly

My point is that the WWW was a lot more than static HTML and CSS pretty soon after its inception.

You're confusing displaying different information at different URLs with being "more than static HTML and CSS".

Re: Entire website in a single HTML file

#314
post #249

Earlier quoted context omitted.

They shouldn't be surprised, though. That's the point. The whole web dev community seems to have forgotten about the foundational web standards.

This wasn't a foundational web standard. The :target pseudoclass was introduced in CSS3. The article is not another pointless potshot at frameworks, it's showing a clever use of a new standard to allow multiple pages in the same HTML document without using Javascript.

CSS 3 was released in 1999 and the :target pseudo class is in the spec. So not exactly new... [1] https://www.w3.org/TR/1999/WD-CSS3-selectors-19990803#target...

Re: Entire website in a single HTML file

#315
post #246

Earlier quoted context omitted.

It is a static site. Only that I decided to hand roll my own implementation instead of using something like Jekyll. And as it doesn't have any server for the markdown (they are just CDN files), I have to use JS to do the translation to HTML.

Why not render them on your own computer after you write them?

Simple and efficient. I can maybe setup a build step for the markdown. Thanks for the suggestion. Can't believe it never crossed my mind

Re: Entire website in a single HTML file

#316

Lovely article and such an interesting way of creating single page apps. I never knew about this usage of the :target selector. I think a major issue with this approach is just practicability - I'd want to write my content in something like markdown and we will anyway need JS to convert the markdown to HTML. I have also been interested in making SPAs, my my way is more traditional. Using javascript for the stitching.…

> we will anyway need JS to convert the markdown to HTML. You could compile the markdown to HTML server-side …

This whole approach was an exercise in avoiding the server back-end.

Re: Entire website in a single HTML file

#318
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…

One suggestion, set the overflow to "scroll" so the scrollbar is always visible. When I open a section it appears, adding like 10px on the right and all the content moves left.

Re: Entire website in a single HTML file

#319

Earlier quoted context omitted.

If only the Web had a way to make text clickable withtout showing the whole target URL.

I find inline links incredibly disruptive to my reading flow, the change in color makes my eyes start jumping around in the text. Wikipedia especially is absolutely hopeless, to the point where I've built a mirror that removes all inline links. (A page looks like this: https://encyclopedia.marginalia.nu/wiki/Hyperlink )

Wouldn't a user script work just as well for this purpose? `document.querySelectorAll('a').for each(a=>{a.outerHTML=a.innerHTML});`

Re: Entire website in a single HTML file

#320
post #319

Earlier quoted context omitted.

I find inline links incredibly disruptive to my reading flow, the change in color makes my eyes start jumping around in the text. Wikipedia especially is absolutely hopeless, to the point where I've built a mirror that removes all inline links. (A page looks like this: https://encyclopedia.marginalia.nu/wiki/Hyperlink )

Wouldn't a user script work just as well for this purpose? `document.querySelectorAll('a').for each(a=>{a.outerHTML=a.innerHTML});`

Sure, that works too. You still get the megabyte pageloads though, and you need to carry the script with you every where you go.
Post reply on HN