Live data from Hacker News

Ask HN: Best tiny JavaScript framework?

news.ycombinator.com

41–46 of 46 posts

Re: Ask HN: Best tiny JavaScript framework?

#41
My idea would be something like this.

Use any tiny View Library like Preact Inferno, etc. and use the Flux Architecture without any other framework, you implement the store by hand or using some immutable lib and use a simple dispatcher. That way you have a maintainable code since Flux is pretty popular and no big framework.

Re: Ask HN: Best tiny JavaScript framework?

#43

Earlier quoted context omitted.

What "hacks" do you expect from using plain JavaScript? The biggest hack in plain JS is usually in my experience creating HTML elements dynamically based on data. That's where Handlebars would come in.

I just mean that over the course of building vanilla JavaScript applications, people often add layer of functionality that are implemented worse than libraries, are harder to maintain, or are not as compatible. Like yes, I could build my own routing library, and that is probably fine, and yes I can build my own state management library, and so on, but at a certain point you are just rebuilding a framework from scratc…

We managed to survive and create functional websites for years without a "routing library" and without creating our own custom routing library.

But that's the beauty of using Handlebars. If at a later date you do need a full fledge framework, you can use Ember - that uses a superset of Handlebars.

Re: Ask HN: Best tiny JavaScript framework?

#44

Why do you need such a tiny footprint?

I need a footprint that works well with mobile devices, slow internet connections, etc. Also, I prefer smaller frameworks as they have less cognitive load - I usually am more able to read the source code, understand the API, and so on.

How big do you think your application code is going to be? There's not much point making your life a lot harder for the sake of about 15 extra KB for example. If their internet connection is that bad then the web page probably shouldn't contain a single medium sized image on it. That's a tiny amount of data to be worrying about.

You'd be better using something small and efficient like Vue to get it released and optimise it later if it's successful. Optimising now for extremely small file sizes doesn't sound like a good idea to me in terms of getting it finished.

The reality with side projects is they're much more likely not to be used because they're not finished, not because they're a few KB too big.

Re: Ask HN: Best tiny JavaScript framework?

#45
post #16

http://mithril.js.org/ Size < 8kb gzipped (includes routing and ajax)

Do you know of any good mithril projects out in the wild?

Flarum is a good one - like Discourse but nice: http://flarum.org/

Memrise.com use it for their apps.

Guild Wars 2 uses it for in-game UI.

More here: https://github.com/lhorie/mithril.js/wiki/Who-Uses-Mithril

Re: Ask HN: Best tiny JavaScript framework?

#46
One option would be to custom build jQuery and omit the parts you don't need or like. The libraries posted all have their merits; but jQuery has so much traction. That means more folks ready to hit the ground running on what you're building ... https://github.com/jquery/jquery

Edit Gruntfile.js to do that or try a site like: projects.jga.me/jquery-builder/

You can get sub-20Kb builds with just what you need. I did that recently to inline the core parts ...

One tip, if you use the builder, take a screenshot! The file generated will have a comment block with - in front of omitted modules, e.g. -ajax if you prefer plain old fetch & other useful info. But the screenshot shows exactly what options you set.

Post reply on HN