TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Best tiny JavaScript framework?

29 点作者 levthedev大约 8 年前
I&#x27;m deciding on a Javascript framework to use in building a real time chat application with a tiny footprint. I can&#x27;t use React, Angular, Ember, or Vue because they are too large. I would build the app in vanilla Javascript, but I fear that it will become more and more difficult to maintain and I will end up reimplementing many already solved problems.<p>Some of the frameworks that I&#x27;ve seen that are small, fast, and well-liked are Preact, Inferno, Mithril, and Ractive. Does anyone have any experience with these, or even better, thoughts on a comparison between them?

21 条评论

bmh_ca大约 8 年前
I designed tko (<a href="https:&#x2F;&#x2F;github.com&#x2F;knockout&#x2F;tko" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;knockout&#x2F;tko</a>) to make it easy to re-use the best parts of Knockout using tree-shaking ES6 imports.<p>When experimenting with substituting a few modules, I&#x27;ve gotten it down to 4.5k gzipped.<p>It&#x27;s still quite early on (alpha), but already some folks are using it in production. Plus, it&#x27;s mostly backwards-compatible with Knockout.<p>While it might not be an ideal, usable solution for this problem yet, it&#x27;s definitely moving in the direction of filling exactly this niche (among others).
neilsimp1大约 8 年前
Is there a maximum file size that you&#x27;re looking for? Because Vue.js is pretty small, 23K after gzip:<p><a href="https:&#x2F;&#x2F;gist.github.com&#x2F;Restuta&#x2F;cda69e50a853aa64912d" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;Restuta&#x2F;cda69e50a853aa64912d</a>
评论 #13830377 未加载
Svenskunganka大约 8 年前
There are two that I know of that are truly tiny: Monkberry[0] and RE:DOM[1] which are respectively 1kb and 2kb in size.<p>[0]: <a href="http:&#x2F;&#x2F;monkberry.js.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;monkberry.js.org&#x2F;</a><p>[1]: <a href="https:&#x2F;&#x2F;redom.js.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;redom.js.org&#x2F;</a>
评论 #13830409 未加载
rk06大约 8 年前
<a href="http:&#x2F;&#x2F;mithril.js.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;mithril.js.org&#x2F;</a><p>Size &lt; 8kb gzipped (includes routing and ajax)
评论 #13831388 未加载
lfx大约 8 年前
If you need tiny footprint best idea would be just to use Vanilla JS. But you can look here for some libs&#x2F;frameworks for specific parts <a href="http:&#x2F;&#x2F;microjs.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;microjs.com&#x2F;</a>
heycato大约 8 年前
I like the dom wrapper this guy came up with: <a href="https:&#x2F;&#x2F;hackernoon.com&#x2F;how-i-converted-my-react-app-to-vanillajs-and-whether-or-not-it-was-a-terrible-idea-4b14b1b2faff#.lcwbdi7ci" rel="nofollow">https:&#x2F;&#x2F;hackernoon.com&#x2F;how-i-converted-my-react-app-to-vanil...</a><p>I adapted it for myself here: <a href="https:&#x2F;&#x2F;gitlab.com&#x2F;heycato&#x2F;domjs&#x2F;blob&#x2F;master&#x2F;dom.js" rel="nofollow">https:&#x2F;&#x2F;gitlab.com&#x2F;heycato&#x2F;domjs&#x2F;blob&#x2F;master&#x2F;dom.js</a>
评论 #13831462 未加载
kowdermeister大约 8 年前
Vue is really small: 18kb min+gzip is tiny compared to the competition.<p>Check also <a href="http:&#x2F;&#x2F;riotjs.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;riotjs.com&#x2F;</a> 9.73KB (gzip)
评论 #13831495 未加载
maherbeg大约 8 年前
How about basically no framework with svelte? <a href="https:&#x2F;&#x2F;svelte.technology&#x2F;" rel="nofollow">https:&#x2F;&#x2F;svelte.technology&#x2F;</a>
评论 #13830777 未加载
评论 #13831542 未加载
Psypersky大约 8 年前
My idea would be something like this.<p>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.
ppetty大约 8 年前
One option would be to custom build jQuery and omit the parts you don&#x27;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&#x27;re building ... <a href="https:&#x2F;&#x2F;github.com&#x2F;jquery&#x2F;jquery" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jquery&#x2F;jquery</a><p>Edit Gruntfile.js to do that or try a site like: projects.jga.me&#x2F;jquery-builder&#x2F;<p>You can get sub-20Kb builds with just what you need. I did that recently to inline the core parts ...<p>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 &amp; other useful info. But the screenshot shows exactly what options you set.
doublerebel大约 8 年前
For virtual DOM I don&#x27;t go full React, I just use Maquette with Jade templates.<p><a href="http:&#x2F;&#x2F;maquettejs.org" rel="nofollow">http:&#x2F;&#x2F;maquettejs.org</a> <a href="https:&#x2F;&#x2F;github.com&#x2F;nextorigin&#x2F;gulp-pug-hyperscript" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nextorigin&#x2F;gulp-pug-hyperscript</a><p>For a small framework, I&#x27;ve been using SpineJS for years. <a href="https:&#x2F;&#x2F;github.com&#x2F;spine&#x2F;spine&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;spine&#x2F;spine&#x2F;</a><p>Example with Maquette:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;nextorigin&#x2F;maquette-mapper" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;nextorigin&#x2F;maquette-mapper</a><p>Using focused, quality components has let me upgrade my stack piece by piece over the years while retaining backwards compatibility.
评论 #13831441 未加载
evilc0大约 8 年前
Have a Look at Backbone.js. <a href="http:&#x2F;&#x2F;backbonejs.org" rel="nofollow">http:&#x2F;&#x2F;backbonejs.org</a> I have choosen the lib for similiar reasons and i loved it
评论 #13831838 未加载
snicky大约 8 年前
Try <a href="https:&#x2F;&#x2F;github.com&#x2F;wavesoft&#x2F;dot-dom" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;wavesoft&#x2F;dot-dom</a><p>It looks like tiny React and is just 511b gzipped.
daliwali大约 8 年前
Shilling my own library here: <a href="http:&#x2F;&#x2F;simulacra.js.org" rel="nofollow">http:&#x2F;&#x2F;simulacra.js.org</a><p>No template syntax to learn, one function API, 5kb gzipped.
33a大约 8 年前
Choo! <a href="https:&#x2F;&#x2F;github.com&#x2F;yoshuawuyts&#x2F;choo" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;yoshuawuyts&#x2F;choo</a>
scarface74大约 8 年前
Do you need a framework at all? I think you could get away with just plain JavaScript and include Handlebars if you want a templating engine.<p>Maybe add Jquery if you want something just above plain JavaScript.<p>Edit:<p>Another benefit of Handlebars is that if you ever do decide you need a full framework, you can use Ember and leverage your Handlebars templates.
评论 #13831485 未加载
seanwilson大约 8 年前
Why do you need such a tiny footprint?
评论 #13830502 未加载
评论 #13830463 未加载
kruhft大约 8 年前
PX2: <a href="https:&#x2F;&#x2F;github.com&#x2F;burtonsamograd&#x2F;px2" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;burtonsamograd&#x2F;px2</a><p>A better designed version of Backbone with a small footprint.
mabynogy大约 8 年前
NoJS (posted few days ago):<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=13816429" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=13816429</a>
kawera大约 8 年前
intercooler.js may fit the bill: <a href="http:&#x2F;&#x2F;intercoolerjs.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;intercoolerjs.org&#x2F;</a>
jlebrech大约 8 年前
<a href="http:&#x2F;&#x2F;mithril.js.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;mithril.js.org&#x2F;</a>