Live data from Hacker News

Mini projects built with VanillaJS. No frameworks or libraries

github.com

21–30 of 171 posts

Re: Mini projects built with VanillaJS. No frameworks or libraries

#21
post #16

Interesting. As a developer who's done no front end work since the nineties and has had little appetite for getting back into it (after having seen what modern front end devs seem to contend with) I surmise that all those crap.js frameworks of the month don't do a whole lot of useful stuf after all. I suspected as much but was always too timid to speak up when I observed how much noise and fury in the office produced…

It depends.

You can do quite a fair bit with vanilla JS, HTML, and CSS.

Things get a little tricky when you start having to maintain a lot of state that multiple elements need to be aware of.

It's not impossible to do this with vanilla JS, but the mental model can be a bit difficult and this gets amplified across teams.

What crap.js frameworks do well is provide a contract for how state can be organized and how components should react/interact with the change in state. This scales well across teams as following a set of mutually agreed upon conventions produces more legible code instead of an entire team rolling their own code for everything.

Re: Mini projects built with VanillaJS. No frameworks or libraries

#22
post #18
post #16

Interesting. As a developer who's done no front end work since the nineties and has had little appetite for getting back into it (after having seen what modern front end devs seem to contend with) I surmise that all those crap.js frameworks of the month don't do a whole lot of useful stuf after all. I suspected as much but was always too timid to speak up when I observed how much noise and fury in the office produced…

I always find it interesting that the people who unabashedly admit they have minimal front-end experience usually have the strongest condemnation of the current tools.

Don’t worry. People with a lot of front-end experience, in this case me, also condemn the current tools.

Re: Mini projects built with VanillaJS. No frameworks or libraries

#23

There’s no need for these projects to be “mini”. Javascript and html is a good choice for big things too. It’s still my go to “frontend stack” for lots of stuff today. Here’s a pretty big “VanillaJS” project I built back in 2006, back when we called these things web apps: https://www.twiddla.com/

Here is my VanillaJS project from 2010. http://np.ironhelmet.com

(OK, there is a bit of jquery in there.)

Re: Mini projects built with VanillaJS. No frameworks or libraries

#24
Lately I've really enjoyed writing small apps in vanilla TypeScript. Since the TS compiler generates JavaScript that works in modern browsers and those also support the module syntax natively, you can get away without using NPM and a bundler like Webpack at all. Of course this starts to fall down when you get over a certain size but it works well and is quick to get going with for simple things like this lunch menu I built: https://gitlab.com/Nicd/sodexo-menu

The only gripe I have there is that you need to write imports with a JS extension as the TS compiler won't change them. So to import `foo.ts`, you need to write `"./foo.js"`. The compiler understands it and it also allows the browser to understand it too.

Re: Mini projects built with VanillaJS. No frameworks or libraries

#25
post #24

Lately I've really enjoyed writing small apps in vanilla TypeScript. Since the TS compiler generates JavaScript that works in modern browsers and those also support the module syntax natively, you can get away without using NPM and a bundler like Webpack at all. Of course this starts to fall down when you get over a certain size but it works well and is quick to get going with for simple things like this lunch menu I…

Too bad we can’t have php style autoloading in JS.

Actually what I really want is to lazy-load modules on demand! So if something is concatenated into a giant file then I don’t need to load modules anymore.

Like maybe this:

  function load(module) {
    if (load.loaded[module]) return;
    import(module)
    .then(() => load.loaded[module] = true);
  }

Re: Mini projects built with VanillaJS. No frameworks or libraries

#26
post #25
post #24

Lately I've really enjoyed writing small apps in vanilla TypeScript. Since the TS compiler generates JavaScript that works in modern browsers and those also support the module syntax natively, you can get away without using NPM and a bundler like Webpack at all. Of course this starts to fall down when you get over a certain size but it works well and is quick to get going with for simple things like this lunch menu I…

Too bad we can’t have php style autoloading in JS. Actually what I really want is to lazy-load modules on demand! So if something is concatenated into a giant file then I don’t need to load modules anymore. Like maybe this: function load(module) { if (load.loaded[module]) return; import(module) .then(() => load.loaded[module] = true); }

You could probably write such a thing using the dynamic `import()` that is quite supported: https://caniuse.com/#feat=es6-module-dynamic-import

In fact it's most likely someone has already done that.

Re: Mini projects built with VanillaJS. No frameworks or libraries

#27
post #2

It's interesting that vanilla JS feels like a breath of fresh air nowadays. I guess the JS cycle is now complete (?)

It depends on the scale of your project. Not using a cement mixer is a breath of fresh air if you just need the mortar to fix a single brick.

I have seen projects that were big in scale only because they were overengineered and tried to stuff every fad into the stack.

Re: Mini projects built with VanillaJS. No frameworks or libraries

#28

I implemented an entire database in VanillaJS: It runs in-production with 10M+ monthly users! https://github.com/amark/gun ~13KB I get a lot of hate for not-using-2ton-framework-of-the-month. But I think prioritizing performance is worth the flack. Seeing repos/articles like this deeply warm my heart, maybe us VanillaJS devs are not alone after all! Does anybody have other favorite VanillaJS projects, that they could…

Not sure why you are being downvoted. Really interesting project, thousands of stars in gh, nice documentation... Thanks for sharing!

Re: Mini projects built with VanillaJS. No frameworks or libraries

#29
post #18

Earlier quoted context omitted.

I always find it interesting that the people who unabashedly admit they have minimal front-end experience usually have the strongest condemnation of the current tools.

Don’t worry. People with a lot of front-end experience, in this case me, also condemn the current tools.

[deleted]

Re: Mini projects built with VanillaJS. No frameworks or libraries

#30
post #6

I love these type of showcases. It‘s been a wonderful time when simply upload files via SFTP and had a running application. No need of webpack bundles, vendor libraries to achieve a simple functionality that could be solved in a few lines of code ... I really do hope this kind of developer attitude (writing pure VanillaJS) is coming back.

There's a reason why a lot of those libraries and tools are used though. Webpack bundles are used to strip down multiple JS files and libraries into a single bundle that contains only what is needed to run a particular application. Libraries like React serve a purpose too, particularly when you're building large applications that need to be maintained by many people all at once, or when you need insane compatibility…

Alas, the reason #1 these tools are used is cargo-culting.
Post reply on HN