3 ms·
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
by rishav_sharan 5y ago
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. But only Vanillajs. I don't use any frameworks and bundlers for my SPAs. In fact right now I am working on a simple blog: http://rishav-sharan.com http://rishav-sharan.com using just HTML, Vanilla js and Tailwindcss.
If anyone is interested in my approach, I have an article detailing things there, or you can just read through the source. Its un-minified and fairly readable.
- atq2119 5y agoThere are plenty of non-JS converters from Markdown to HTML and static websites are a thing.
- rishav_sharan 5y agoIt 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.
- xigoi 5y agoWhy not render them on your own computer after you write them?
- rishav_sharan 5y agoSimple and efficient. I can maybe setup a build step for the markdown. Thanks for the suggestion. Can't believe it never crossed my mind
- selfishclouds 5y agoThe author of the site linked in the article suggests a couple of Markdown options for this on their blog page [1]. In this, they link a port of their website as a Jekyll theme [2]. 1. https://john-doe.neocities.org/#blog https://john-doe.neocities.org/#blog 2. https://github.com/bradleytaunt/john-doe-jekyll https://github.com/bradleytaunt/john-doe-jekyll
- southerntofu 5y ago> Please enable Javascript to view this site. This is a Single Page Application and it needs JS to render. That's the entire problem with JS: i can't browse a page without a complex rendering engine (arguably full of security vulnerabilities) or even scrape it. Something like webmention/microformats (indieweb) federation becomes almost impossible with you due to your setup. Also worth noting, rendering the Markdown on the client is super inefficient. First, because client-side JS will always be far slower than native code server-side: i first need to download the entire JS then run it in a super slow sandbox. Second, because there's economies of scale to be had: it may take a few milliseconds to build the markup, but every client has to do it. For n client, that's O(n) complexity vs O(1) for server-side rendering. So many CPU cycles wasted :)
- gnubison 5y ago> we will anyway need JS to convert the markdown to HTML. You could compile the markdown to HTML server-side …
- rishav_sharan 5y agoThis whole approach was an exercise in avoiding the server back-end.
- iFreilicht 5y agoJust a heads up, I get the “you need javascript” warning when using Firefox for iPad. I never had that with any website before, and I can switch between the two color schemes, which requires JS (i think). I’m also more in favor for compiling the MD to HTML once and then serving pure HTML via the CDN. You could still keep it to the two steps you outlined in your blog post by running the build step and deployment using github actions.