News for hackers. Stuff that matters.
Re:VanJS (Vanilla JavaScript): smallest reactive UI framework by jitl on Thursday May 25, 2023 @04:22AM (#36068278)
It’s 93 lines, less than most CSS resets. Small enough to copy paste to the top of your index.html in a script tag. You can use it without NPM, webpack, a special compiler pass, or a template language. Seems pretty vanilla compared to the full fat, popular alternatives.
Re:VanJS (Vanilla JavaScript): smallest reactive UI framework by not_your_vase on Thursday May 25, 2023 @04:39AM (#36068369)
Seems pretty vanilla compared to the full fat, popular alternatives? Absolutely!

Does it seem vanilla compared to vanilla? Haha..

Re:VanJS (Vanilla JavaScript): smallest reactive UI framework by jwarren on Thursday May 25, 2023 @04:56AM (#36068455)
You're mixing metaphors there! It might be lightweight but it's still a flavour.

It's still not part of the common browser API, so yes it's easy to add, but no, it's not vanilla.

Re:VanJS (Vanilla JavaScript): smallest reactive UI framework by Anon4Now on Thursday May 25, 2023 @05:07AM (#36068507)
> it's still a flavour.

> it's not vanilla.

Hate to interrupt, but vanilla is a flavor. And it's a pretty good one, dammit!

Re:VanJS (Vanilla JavaScript): smallest reactive UI framework by rgoulter on Thursday May 25, 2023 @05:15AM (#36068549)
Insofar as the discussion on the name "vanilla javascript" goes, this mixes metaphors.

"Vanilla JavaScript" implies "without anything added".

Re:VanJS (Vanilla JavaScript): smallest reactive UI framework by ohgodplsno on Thursday May 25, 2023 @05:25AM (#36068613)
Minified React is 1 line, line length isn't exactly a great judge of how much it does.

It's 3KB of barely documented code.

Re:VanJS (Vanilla JavaScript): smallest reactive UI framework by nailer on Thursday May 25, 2023 @05:31AM (#36068654)
That's nice but still: don't do that. VanillaJS is already a thing. Make your thing have a different name.
Re:VanJS (Vanilla JavaScript): smallest reactive UI framework by nextlevelwizard on Thursday May 25, 2023 @05:55AM (#36068774)
If I tell someone to "just use vanilla js" and they go googling and end up using VanJS instead.... that aint good.
Re:VanJS (Vanilla JavaScript): smallest reactive UI framework by usrbinbash on Thursday May 25, 2023 @06:01AM (#36068816)
> Seems pretty vanilla

No it doesn't, same as "automobile" doesn't seem pretty Saturn-5, despite the fact that both are moving under their own power.

Terms have meaning, including meaning derived from communities by and large accepting that a certain term has a certain semantic meaning. And the accepted semantic meaning of "Vanilla Javascript" is "runs without a framework besides the browsers own API".

If my code works out of the box in an unmodified browser, then it is Vanilla JS. If I have to load a framework for it to work, then it isn't, period. And it matters exactly nothing whether the framework in question has 900,000 or 9 lines of code.

Re:VanJS (Vanilla JavaScript): smallest reactive UI framework by rawoke083600 on Thursday May 25, 2023 @06:13AM (#36068885)
^^^100%
Re:VanJS (Vanilla JavaScript): smallest reactive UI framework by zambal on Thursday May 25, 2023 @06:43AM (#36069073)
So loading an external library or framework isn't Vanilla JS, but if I copy/paste the VanJS source into a script tag, nothing gets loaded, there's no syntax magic, just some function calls, so that's Vanilla JS, right? If the latter isn't Vanilla JS by your definition, can I at least copy/paste something from stackoverflow?

Trying to make Vanilla JS a strict definition seems pointless to me in the first place.

Re:VanJS (Vanilla JavaScript): smallest reactive UI framework by usrbinbash on Thursday May 25, 2023 @07:18AM (#36069293)
> so that's Vanilla JS, right

I think we don't have to argue about the distinction between the library code and the application code. It doesn't matter how the library is loaded. You can get it from a CDN at runtime, load it from a scriptbundle, copypaste it into a <script> tag, it doesn't matter.

It's still library code that the rest of the application depends on. As soon as that is the case, it's no longer what the JS community by and large calls "Vanilla JS".

This is Vanilla JS:

    fetch('/readme.txt')
    .then(response => response.text())
    .then(data => console.log(data))
    .catch(error => console.log(error))
This isn't:

    awesomeLib().goesBrrrrr()
> Trying to make Vanilla JS a strict definition seems pointless to me in the first place.

Being able to name things, and having clarity in a community about what names denote, is anything but pointless.

Re:VanJS (Vanilla JavaScript): smallest reactive UI framework by NoWizards on Thursday May 25, 2023 @09:50AM (#36070687)
When you do it this way isn't even a framework is just a helper library (at his best). There is another concept for this kind of micro-libraries but calling "framework" to something that will not establish a frame of work for you.
Re:VanJS (Vanilla JavaScript): smallest reactive UI framework by svachalek on Thursday May 25, 2023 @12:39PM (#36072925)
The important part is that if you don't copy VanJS into a script tag, or use it all, you're still doing Vanilla JS.
Re:VanJS (Vanilla JavaScript): smallest reactive UI framework by joesb on Friday May 26, 2023 @09:09AM (#36083591)
> If my code works out of the box in an unmodified browser, then it is Vanilla JS. If I have to load a framework for it to work, then it isn't, period.

Minor nitpick, third party library and framework does not modify your browser. They all still run on unmodified browsers.