Live data from Hacker News

Show HN: Plain Vanilla – a tutorial website for vanilla web development

plainvanillaweb.com

1–10 of 19 posts

Show HN: Plain Vanilla – a tutorial website for vanilla web development

#1
This site explains how to do web development without any tools or frameworks, relying only on the browser and web standards. I made it because I couldn’t find a single place online that put together all the right information in the way that I liked. The site itself is of course also vanilla and open sourced on github.

Show HN: Plain Vanilla – a tutorial website for vanilla web development
plainvanillaweb.com

Re: Show HN: Plain Vanilla – a tutorial website for vanilla web development

#2
I've been thinking about doing something like this for the past few months, kudos for giving it a shot!

I disagree with your statement: "Don't use the plain vanilla approach until you've tried some of the popular web development frameworks and have learned why you might want to do without, and until you're confident on how to structure a codebase without the help of a framework."

I was writing vanilla javascript for years before I began using frameworks, so when I encounter a new one, I understand exactly what problem it's trying to solve. For any beginners, I personally recommend just building websites directly, without any framework assistance.

Re: Show HN: Plain Vanilla – a tutorial website for vanilla web development

#3
I've actually been struggling with a problem related to this. First time page loads if you have a 2000loc JavaScript file + index + css + favicon requests nothing but those 4 resources, which is very quick on a keep-alive http 1.1 server.

I've written all of that from scratch because I got tired of maintaining node.js

But when splitting up the js file into pieces and using es6 modules, say 12 different files, Chrome makes 8 TCP connections on 8 different sockets, and each connection has its own TCP handshake (and TLS handshake for https). How do you bundle things without using a build system or a bundler? Import maps help, and it's not difficult to simply hash the page and copy the asset to a "dist/" folder with the hash appended, but it's still slow on first page load.

I'm not a web developer professionally (or network engineer), so I'm learning about web networking myself for the first time. It might be helpful to add a section about "traffic shaping"? I've smacked together a service worker that does the work of caching well-enough for now, but I'm definitely doing something rather strange and reinventing something. My page loaded significantly faster when it was just 1 JS file, no caching needed.

Re: Show HN: Plain Vanilla – a tutorial website for vanilla web development

#5
post #3

I've actually been struggling with a problem related to this. First time page loads if you have a 2000loc JavaScript file + index + css + favicon requests nothing but those 4 resources, which is very quick on a keep-alive http 1.1 server. I've written all of that from scratch because I got tired of maintaining node.js But when splitting up the js file into pieces and using es6 modules, say 12 different files, Chrome…

It's hard to bundle without a bundler, but...

It sounds like preloading modules would help your case a lot: https://web.dev/articles/modulepreload

The number of connections is a bit of a red herring here, the problem is (typically) that the browser loads one module which then tells it to load another module, and so on. Each round-trip is wasted time. Preloading gives the browser a flat list of all required dependencies right away. By the way, this applies to everything else: having all required resources declared at the top of the page makes things faster. You can even preload some less-obvious things like background images referenced by CSS files.

This might achieve the "bundling" you want, in the sense that all the preloaded resources can be multiplexed into a single connection. But again, the number of connections is almost nothing compared to the number of round-trips required.

Re: Show HN: Plain Vanilla – a tutorial website for vanilla web development

#6
post #3

I've actually been struggling with a problem related to this. First time page loads if you have a 2000loc JavaScript file + index + css + favicon requests nothing but those 4 resources, which is very quick on a keep-alive http 1.1 server. I've written all of that from scratch because I got tired of maintaining node.js But when splitting up the js file into pieces and using es6 modules, say 12 different files, Chrome…

HTTP 2 and above will use one connection to retrieve several files. Caddy [1] can act as a static file server that will default to HTTP 2 if all parties support it. No configuration required.

If you allow UDP connections in your firewall, it will upgrade to HTTP 3 automagically as well.

I highly recommend it

[1] https://caddyserver.com/

Re: Show HN: Plain Vanilla – a tutorial website for vanilla web development

#7
Nice work, I haven't tried web components but support is better than I expected per caniuse[0]. This weirdly reminded me of a time 12 years ago[1] when I was encouraged to avoid using the term "vanilla" as it sounds like another framework

[0] https://caniuse.com/?search=web%20components [1] https://stackoverflow.com/a/11487293/691156

Re: Show HN: Plain Vanilla – a tutorial website for vanilla web development

#9
post #7

Nice work, I haven't tried web components but support is better than I expected per caniuse[0]. This weirdly reminded me of a time 12 years ago[1] when I was encouraged to avoid using the term "vanilla" as it sounds like another framework [0] https://caniuse.com/?search=web%20components [1] https://stackoverflow.com/a/11487293/691156

http://vanilla-js.com/ (the SSL certificate expired 15 years ago)

It is a framework, but just vanilla :)

Re: Show HN: Plain Vanilla – a tutorial website for vanilla web development

#10
I'm totally into vanilla web development. Almost all the frameworks are either trying to solve the problems caused by the browser, or trying to force developers follow their style so that the developers make less mistakes.

But the browser evolves:

- Convenient and flexible browser APIs totally replaced jQuery

- HTTP2 HPACK, multiplexing and connection coalescing make SPA and bundlers unnecessary

- Web Component and Shadow DOMs helps you write modular HTML and CSS

etc etc

And developer needs to evolve, too! These frameworks make too many leaky abstractions that developers should think about. It turns out if they don't encounter problems at the beginning, they will meet them later with interest.

I was going to write a similar document, but thankfully you write it so well!

P.S. I'm also not against the framework to solve engineering problems like testing or CI/CD.

Post reply on HN