370 points · by tipiirai · 3y ago · 275 comments
I'm releasing two things today:
1. Nue JS: https://nuejs.org/docs/nuejs/ — A tiny (2.3kb minzipped) JavaScript library for building user interfaces. It's like React/Vue core, but there are no hooks, effects, props, or other unusual abstractions on your way. Know the basics of HTML, CSS, and JavaScript and you are good to go. Nue JS supports server-side rendering (SSR), reactive components, and "isomorphic" combinations. It takes inspiration from Vue 2.0 and Riot.js. (I'm actually the original author of Riot).
2. Nue ecosystem: https://nuejs.org/ecosystem/ — This is the ultimate goal and once all the sub-projects are finished, Nue will be a serious alternative to things like Vite, Next.js, and Astro.
The thing is that I'm not happy with the current state of web development, so I want to write a completely new ecosystem from scratch. I'm taking advantage of the "old" innovations like progressive enhancement, separation of concerns, and semantic web design. Benefits highlighted here: https://nuejs.org/why/
All projects will be released under the MIT license.
Happy to answer any questions.
I know some devs do care about bundle size but most f/e devs I've worked with don't really care about that. They care more about their Dev Experience so you should be showing them how it's the same or better with your new tool.
And then came a code size comparison, this example is ok, but display it later, show first a simple example in which way it change it, e.g. a small code snippet? How does Nue look?
The only comparison with Astro is missing. https://nuejs.org/compare/component.html
Source code:
https://github.com/nuejs/www/blob/master/todomvc/todo-compac...
More details to come
There are so many JS frameworks, more every day, why should I care about 'yours'?
The examples will show me if this is true or not, and how easy it will be, also important
Nue is small, so it adds no hidden magic. Some examples are really huge.
but the link is broken, it's actually: https://github.com/nuejs/www/blob/master/todomvc/todomvc-com...
However, it is more like an alternative to Petite-Vue or Riot.js rather than full-blown Vue or React. Therefore your comparison vs headlessui-react/vue is like apple vs orange/banana: headless UI listbox is much more complicated than your implementation. You can easily make a listbox in Vue using a similar amount of code as Nue.
One thing which is lacking in your Getting Started (https://nuejs.org/docs/nuejs/getting-started.html) is how to use Nue without a build step, in order to progressively enhance existing HTML websites like Petite Vue: `<script src="//unpkg.com/petite-vue" defer init></script>` or Alpine.js: `<script src="//unpkg.com/alpinejs" defer></script>`?
How is Nue performance compared to other JS frameworks? Could you add it to https://krausest.github.io/js-framework-benchmark/current.ht...?
You are right: Nue takes inspiration from Vue 2.0, petite-vue and Riot.
I'll make the comparison more fair, but it doesn't take out the fact that React/Vue promote use of "spaghetti" code where logic/layout/styling are mixed together making the code hard to read and causes the size to grow. Everywhere I look the projects are unnecessarily big. Very often in the factor of 10x too big.
Pretty sure Nue JS will always need a build step. I don't like the idea to load the compiler and run JS exec() on the client side. Heavy and unsecure.
Haven't checked performance yet. I want to see this project getting more traction before deep diving to benchmarking
Probably not intentionally deceitful, but it a ridiculous comparison.
However, according to BundleJS, only nuejs-core's compile() method is 36.2KB minified gzipped: https://deno.bundlejs.com/badge?q=nuejs-core@0.1.0&treeshake... - it is nowhere close to 2.3KB as on your website. Compare it to petite-vue's bundle, which is only 7.3KB: https://deno.bundlejs.com/badge?q=petite-vue@0.4.1
https://nuejs.org/@nue/js/nue.js
local gzip on my machine is 2.3kb
``` <div @name="media-object" class="{ type }"> <img src="{ img }"> <aside> <h3>{ title }</h3> <p :if="desc">{ desc }</h3> <slot/> </aside> </div>
<div class="art-gallery"> <media-object :for="item in items" :bind="item"/> </div ```
I really don't like the opinionated, magical/weird syntax (like vue's :@v-for-OnClick="fn()"), I prefer how close and true to vanilla html/js react is, rather than stuff like this.
I can understand that this syntax is not a preference for JavaScript/TypeScript developers who opt to JSX and want to write everything (logic, layout, styling) in JavaScript.
<p :if="desc">{ desc }</h3>
That </h3> should be a </p>, I think.I just looked at some Svelte examples and it's a mix of magic keywords (on, bind) with magic symbols (: | @) and new, completely unrelated syntax to both JS and HTML (#each, #if, :else). I guess it looks way more idiomatic if you have an IDE that highlights and lints it correctly. React with its few rules of hooks seems way closer to vanilla JS.
The goals of this project and Svelte seem very similar, so I'd be interested to see a more in-depth comparison.
Its name should always start with `use` so that you can tell at a glance that the rules of Hooks apply to it.
And it is required and enforced if you use the ESLint react-hooks plugin (which I'm guessing most large projects do).
https://developer.mozilla.org/en-US/docs/Web/API/Element/cla...
https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelEl...
I'm not sure that the compilation aspect is relevant - pretty much all modern frameworks using a template language have a compilation step. ngFor doesn't exist in the browser after all! ;)
Rethinking things from the ground up and making it smaller and more RAM efficient, is absolutely brilliant.
More frontend devs needs to stop following the herd and think for themselves and look back at how hackers used to work back in the day to use as little memory as possible.
These days I look at apps like Slack and feel such terrible sadness and despair.
Projects like Nue at least have the right spirit and attitude.
I want to make things very, very differently. Not just because of the size, but maintaining a codebase with 5k lines is so much easier than maintaining 500k lines.
I don’t know what the solution is there.
Question is how we get web developers to learn those, instead of the next (ha) hyped JS frontend frameword.
When I was starting out with HTML, inline styles were considered to be a hack, and the goal of writing good HTML was to separate the data from the presentation as completely as possible. It seems that nowadays people place more emphasis on encapsulation rather than separation, they want their style to live with the component. Separation and encapsulation are in opposition: vertical vs horizontal architecture of code.
Personally I prefer separation. While components are a good way to divide up functionality, when it comes to presentation users are perceiving the UI of your entire website, not the individual UIs of each component. Separating the style into a stylesheet gives you global control over presentation and makes you more aligned with how the user is perceiving things.
This only works for trivial stuff. Presentation is more than just colors, fonts and margins. Layout is deeply intertwined with the structure your HTML, attempts at mitigating this have made a monumental mess of CSS. The sooner you recognize it as the pipe dream that it is, the more time you will have to work on your actual goal.
I also feel the opposite about what the user perceives. The user perceives the result of applying all your CSS rules - which is closer to inline styles everywhere rather than separating things out.
Can you elaborate on this? Do you mean that the separation through external stylesheets creates a more cohesive UI for the user?
The HTML has its say on layout part, so the presentation is not exclusively on the CSS. Also, the core part of defining the whole UI is usually delegated to some global CSS rules, usually known as the theme in CSS-in-JS libraries. I don't think having external stylesheet helps that much.
People in the first camp tend to like Vue, CSS/Sass, Htmx, server rendering, etc.
People in the second camp like React and React Native, CSS-in-JS, Tailwind, etc.
And I like to be an expert in HTML+CSS (at least I try), and still prefer JSX to e.g. Vue's template syntax.
prototype (or throwaway code you don't care about)? JS and tailwind something you have to maintain? TS and external stylesheet
And to make it to HN FP and deal with the ensuing onslaught of comments and feedback is no mean feat! I hope the next few days are insightful and fun and you can maintain a positive outlook about it all.
I haven't looked in great depth yet at what you've made available so please take all of this with a pinch of salt, but I wanted to share my honest 5-minute scan-through braindump with you as if you were watching me do the review in person:
- _Another_ front-end framework (le sigh) - tell me again how you're trying to fix burnout and fatigue 8]
- Let's look at the source for the homepage: https://github.com/nuejs/www/blob/master/index.md
- Oh, this 'Nuemark' actually looks interesting! Is that available yet? No
- Where's the word 'solver' here? It's not here, it's embedded in the CSS. OK :/ not sure if this is intending to be an example of how to do this properly...
- That CSS looks... funky... like a Python developer from 2004 decided to come up with their own terse syntax
- That's not going to play well with current tools. Plus, there MUST be a compilation step, so why choose to make the compiler do a load of work here every time? Saving a few keystrokes feels like very little benefit overall
- The homepage claims that its own HTML, CSS and JS add up to under the "14K" limit (is that kB?) but according to my math (which has been known to be wrong at times) it comes in at 19kB - this is still great, but the content of the page is potentially misleading
I am always open-minded about new tools and will do a thorough and fair review, but a part of the problem for me is the time I invest has to be worth it - like, if I switch, I'm going to use this tool A LOT
As I say, this is just a braindump of a very quick review, so add salt to taste
Is this idiomatic? I refused to use React for years, but if this is normal-ish, it basically cements the decision. An implementation of a ListBox in VGA 0xA0000 framebuffer could be only a little bigger (if even bigger). GtkTreeView, which draws a complete tree/table with columns, resizing, dynamic rows and all the interactions, was 10kloc, afair (now 14). GtkCombobox.c is 5kloc, almost half of that is comments or doxygen.
Would it be possible to use your framework with any server of my choice (Python or Node or even PHP), and use Nue only for the frontend?
In this case, since it's just JS + HTML + CSS, can we have an "Option #3" in https://nuejs.org/docs/nuejs/getting-started.html with no command-line, no `npm install`, no `npm run start`, no use of `npm` at all?
It would be nice to have a Hello world example with just a HTM file + import of Nue from your CDN (or from local). Is that possible?
I'd like to totally avoid npm, etc, just write JS + HTML + CSS, and use my own server.
Are you really planning to create a new build tool?
It’s very cool. I’m on my phone, but I’d like to investigate more later.
Not a fan of the Vue template syntax but it's not a deal breaker.
I really love that you don't need a bundler.
> The amount of code required to build a basic listbox UI component
That is not what is being compared.
The speed graph shows the amount of HTML/CSS/JS on the project home page. Again not even close to a fair comparison, they have completely different content. I can create a sluggish library, with a homepage that is just a plain text link to a GitHub repo and that would rank way higher.
> No TypeScript: Nue embraces the dynamic typing in JavaScript
This is an instant nope for me for any serious projects. I'd expect any serious modern competitor to the status quo to be Typescript-first.
https://codebase.show/projects/realworld
https://medium.com/dailyjs/a-realworld-comparison-of-front-e...
Another project that largely ignores that custom elements and Shadow DOM are readily available on every modern browser (including the ones on your phone) and instead chooses to "simulate" components instead is... short sighted.
I crave something that attempts to fill in the missing pieces between something like say Angular and Lit. Give me something that treats a Web Component as its underlying tech for components but offers good support for animation. Something that comes with simple support for migrations (Ala Ruby on Rails) but doesn't include a ton of tooling for CSS that is not really needed anymore (I'm looking at you React) or was created before JS Modules and is still not making good use of them (ahem... Angular).
So, if someone is still stuck in React land, maybe this will be what they are looking for, but for someone keen to use what is built into modern browsers for speed and smaller apps, this seems like something we should pass on.
https://nuejs.org/docs/nuejs/component-basics.html#slots
I'm unable to see the relationship between the <slot /> tag and the looped content in the 2nd code snippet. Can you clarify that in the documentation?
Edit: I think it would have made more sense if you included the @name="media-object" attribute in the first snippet.
I can see that the slots example needs improvement and more detail. I'll make it shine because slot is such an important feature and helps you build reusable code.
I'll work on the docs as a whole, now that I'm getting this valuable feedback from here.
Why go through that whole progress again with Nue? Or do you foresee some other way of doing highly customizable components?
I'm claiming that mixing logic, content, layout, and styling is spaghetti.
I've been quite enjoying keystone + lit (or react if required) of late and at the very least it feels like solid prior art towards MVC stuff.
Also https://mojojs.org/ for server side.
(I'm not saying "use these" even if I quite enjoy using them myself, but they're my reference points for comparison here)
> mobx-keystone is a state container that combines the simplicity and ease of mutable data with the traceability of immutable data and the reactiveness and performance of observable data, all with a fully compatible TypeScript syntax.
I'm too old to understand all this.
https://nuejs.org/compare/component.html
Even just skimming through, the huge React version includes much more functionality, more accessible (aria attributes are only set on the React version, not on nue).
But its always interesting to see these new projects and approaches pop up.
Nevertheless, I have to agree with the a lot of the other commenters, I would have loved a concrete example front and center, I have to chip into the chior of people dismissing the initial importance of bundle size. I'm also sure a big application written with this library will be able to balloon once you begin using dependencies not optimized for this library.
Generally speaking it's my experience that a lot of frontend libraries unfortunately tend to crumple once the long tail has been reached.
Example please. Which libraries are we talking about?
In my own experience when encountering old Angular applications, there's been a straight forward migration path to the latest versions, that feature in it self is pure gold in my opinion.
like
<div border="1 solid red"> instead of tailwind's <div classname='border-1 border-solid borde-red />
also <div bg-red> too, it supports value-less attributes and one can use a single class name as tag name too, like <bg-red> something </bg-red>
On a sidenote, I was startled by the tailwind mention. Am I out of the loop? Is it not just some css classes? Why is it being compared to React? I’ve used tailwind casually a few times and dont remember it increasing my build size very much at all.
I read some of the comments here, then read the linked “Why” page, and realized many comments are missing the point, fixating on less important points. I recommend you make the Why page the front page instead (merging the current front page graphics and video with it).
Move your “Hello World” blurb to the blog instead. It doesn’t really say anything that Why and front pages don’t, and isn’t crucial front page content.
Maybe also include some info on how it works under-the-hood. For example, given the small size I doubt it’s a virtual-dom based. Is it a compiler model like Svelte and Solidjs? Or something else?
I'm still trying to figure out which JavaScript framework to settle in with for day to day development and I'll give this a spin -- perhaps it'll feel right.
Just curious, how do you handle the client side reactivity? Does it use something like virtual dom with diffing or do you compile everything like Svelte (or even some other strategy)?
I see, I'm not the target audience here, I can't see myself going back to the old ways. But I am happy that people who can't get into the wonder world of utility classes also have frameworks with their philosophy in mind from the core, which could provide more modern solutions for their preferred way of styling.
Let's see how this projects evolves overtime, best of luck!
Please add a mailing list to the homepage so I can keep up to date with your progress. A blog with smaller updates would be nice also.
Best of luck, wishing the author all the best!
At a first glance I like it a lot. With regard to the "Why" section and the FAQ - kudos for the bold claims, that was needed. Typical frontend ecosystem went insane long time ago. Thanks for your effort to bring back the sanity.
Once I saw that in the Svelte example, I couldn't help but wonder if the same applied to the others as well. It all seemed to me beyond simple marketing puffery and into uncharitable and misleading territory.
And honestly:
<select name="Cars" size="6" multiple="multiple">
<option>Mercedes
<option>BMW
<option>Jaguar
<option>Lamborghini
<option>Ferrari
<option>Ford
</select>
Sometimes you need a custom skin all decked out to the nines, but real talk, most folks just need to use the plain old HTML, apply minimal CSS, and move on to the next task.And that's true. It's also true that's what most folks actually need in most cases. That said, another fast implementation using more markup is to have either a hidden radio button group (single selection) or bunch of hidden checkboxes (multiple selection) that are referenced by visible label tags for the rendered listbox. Doesn't break accessibility for screen readers and can even work without JS.
Browsers can do so much out of the box without us constantly reinventing the listbox wheel.
Like you, I dislike much of the modern web frameworks and all the bloat and unnecessary complexities that come with it. I roughly tuned out of this stuff when JQuery became mainstream and everyone and everything started using it, and I couldn't be bothered to keep up any more, nor did I feel inclined to invest my time in such a bloated framework. I did come back to webdev every now and then for casual projects, but every time I did, the world moved from one fad framework to the other, which made me dislike this messy ecosystem even more.
In particular, one environment/toolset that I really disliked was Node.js. Every time I did anything with Node, it always turned into pulling down a gazillion dependencies, and eventually down the line, that led to stuff breaking because some random dependency of a dependency was no longer compatible a with newer version of node or something. It basically put me off modern webdev for good, to the extent that I web back to using plain ol' php for the backend, and since then I've been exploring using pure HTML5+CSS3 without any Javascript for the frontend, but I've been seeing limitations like not being able to do stuff like real-time form validation etc.
Which brings me to your example:
# install dependencies
npm install
May I enquire why you're using npm here? Exactly what dependences are you pulling down? I thought the whole point of Nue was to avoid bloat like Node.js and dependency hell? Isn't Nue supposed to be a self-contained library/ecosystem?Can I use Nue without touching any Node stuff at all?
Node uses a single dependency, htmlparser2 [1], in the package.json [2]. The HTML parser is used to traverse the HTML that is written on the Nue files. I quickly _thought_ of writing my own parser, but right now I'm having my eyes staring at Bun's native HTML parsing capabilities. Instead of Node, I'm using Bun to develop everything. I need less dependencies with it, because things like JS minification or .env file parsing are biult in.
Avoiding NPM dependencies is a high priority!
[1]: https://github.com/fb55/htmlparser2
[2]: https://github.com/nuejs/nuejs/blob/master/package.json#L12
With svelte, it is possible to use "anonymous" classes. So in fact you do not use any classes, but svelte add auto-generate names. like...
<div>{content}</div> <style>div { background: red;}</style>
Firstly, I don't think the comparisons with React/Vue are hugely helpful for Nue. React and Vue do a lot. You're right that most people probably don't need all of that stuff, but it is in the frameworks for a reason - those who need it really do need the complexity.
Some better points of comparison in terms of compile-to-JS frameworks might be Svelte and SolidJS, both of which have some similar goals to this, and specifically focus on producing small, fast code. Alternatively, if you want the "it's just Javascript" approach, Mithril is another great framework oriented around minimising complexity, albeit with a reactivity model more like React's.
I also think the specific code comparisons scattered around the site are similarly unhelpful. For example, you typically use Typescript-based examples for other frameworks, and JS-based examples for your own. This is obviously going to make Nue look smaller, but typically people use Typescript for good reason, and understand the trade-off around code size. More egregiously, many of the comparisons seem very much apples-to-oranges comparisons. For example, the React listbox on the homepage is a part of Headless UI - it meant to be as unopinionated as possible and allow the user of the component to bring their own components, styles, etc. This makes it more complex but more powerful - a trade-off that isn't always worth making, but can be very useful for these sorts of components where 90% of the complexity is getting the UI interactions right. Your example is not headless, I don't think it's even styleable, and while it includes keyboard navigation, the lack of aria tags makes me doubt its accessibility. That doesn't mean it's bad - it looks like the sort of component I'd write as a custom component for a particular project - but it makes the comparison somewhat meaningless. I would imagine any component I wrote in most frameworks I use would be a similar order of magnitude in size.
(In fairness, I've just seen you call both of these points out in your compare FAQ. I disagree with your answers though - a framework's choice to use Typescript internally does not affect the choices of users to write components in Typescript, so "embracing dynamic typing" feels meaningless in this context. Moreover, it's not apples-to-apples if the components themselves are designed with different purposes - a quick React listbox could look a lot simpler if it needed to.)
More practically, I think it would be really helpful if you talked about rendering model more clearly. As a frontend developer, this is one of the first questions I have when looking at a new framework. Is reactivity sound, or am I going to have to spend a week trying to figure out why some variable isn't updating when I think it should be? It looks like the Svelte-style compile-to-DOM-mutations approach, is that right?
I have some other more philosophical quibbles with some of the claims in the documentation and FAQ, but I don't think those are so important. But I do think they you could improve the sales pitch a lot by making the underlying technologies clearer, and by having more useful points of comparison.
As an aside, do you have an entry on the Krausest framework benchmark yet? It may be worth submitting a PR there. Obviously pure framework speed isn't everything, but it's a useful point of comparison to see how one might approach the same problem in different frameworks, particularly a fairly intensive problem.
> <p :if="desc">{ desc }</h3>
should be <p :if="desc">{ desc }</p>
> *and* multi-page
This isn't human-friendly, that would be no markup with some Bold button that converts a word to bold where a simple search for "and multi-page" isn't broken
like
export const [counter, setCounter] = createSignal(0)
you can probably look at js proxies
cue.js: WebAudioAPI framework based on a React render tree
hue.js: Colour authoring and manipulation
sue.js: Framework for terms & conditions with JSX legalese components
We may rue.js the day when another framework follows this pattern.Kudos to the author, the best thing about this is that the source is concise!!
You also benefit from all the available js tooling (editor support for refactoring, linting, syntax highlighting, type checking, etc.).
Lastly JSX eliminates the burden of switching between the framework's template syntax and regular JS/TS when refactoring code and moving logic around.
It’s almost as if there’s a reason for this.
Classic HTML is pretty good for building static websites, but it sucks for building interactive applications.
> Install Bun or Node
Goodbye
* Search—in the Headless UI version there are several hundred lines dedicated to making typing work for jumping to specific list items.
* Multiselect—Headless UI supports multiple selections, yours does not appear to. Again, this accounts for a large number of extra lines in the Vue implementation.
* Focus management—Headless UI has a lot of code dedicated to smoothing out the focus management. In my testing, your implementation has pretty buggy support for using tab to navigate.
* The Headless UI version dedicates a lot of lines to types, where your Nue implementation is dynamically typed. This may be a feature for you, but in my mind those type declarations are doing important work.
* In general, the Headless UI implementation tries to be flexible for many use cases [1], while yours only needs to support the one demo list.
These kinds of comparisons are most persuasive if you can write all the implementations from the ground up, using idiomatic patterns for each framework and identical feature sets for each implementation. When you do that, it's easy to compare and contrast the frameworks. As it is, it's like comparing a house to a garden shed: yes, you've used fewer lines of code, but it's not obvious to me that that's a feature of Nue and not just a byproduct of a less ambitious component.
If the reader wonders where these lines were saved, they will only find broad, general statements about (IMO questionable) values. Compare this to some other frameworks, where the changes from the status quo are clear on the landing page:
- Svelte -> compile step, templating, common features included
- Solid -> signals, constructor functions
- Lit -> web-components, fewer features
It is unfortunately common for new frontend solutions to not be as up-front about their trade-offs as I would like. But this takes the cake for most requirements swept under the rug.
Ultimately Nue will come out with a UI library with a high feature parity with Headless UI. I can imagine the current listbox (demo) doubling it's size with all the above features. Definitely not 10x!
This will actually be a killer addition. I was actually complaining about this the other day: https://news.ycombinator.com/item?id=37448914#37449926
All up, it’s just like so many others, a bad reimplementation of half of what the browser already provides with <select>. About the only thing it adds to that is support for an image per option, and perhaps some more exotic styling aspects (which you hopefully don’t want anyway).
Mind you, I do find Headless UI generally bloated, mostly just suffering from being overly flexible, and it does end up with a moderate amount of code bloat attributable to the particular frameworks’ designs (though not as much as some I’ve seen), but the comparison is just unreasonable. If they think it’s fair to say “With React: 2.5k lines; with Nue: 200 lines”, then I respond: “With HTML: 0 lines”, and insist that <select> is better than the result of those 200 lines.
There are more problems with it, too, whereas I suppose Headless UI will be a pretty high-quality implementation. Examples of problems I found immediately, without having tried to actually run it, but which I presume Headless UI will be free of: it uses <menu> for the options and wraps each option’s label with <strong>, which are both semantic sins; some of the code sharing with combo boxes leads to obvious minor inefficiency (filtering, which can’t actually happen); Escape detection happens on keyup instead of keydown; clicking outside the listbox popup won’t close it if the target or an ancestor matches .open, which is very plausible, e.g. when within a modal dialog (and because it’s ad hoc, it’s certain to interact badly with things like clicking outside modals—any concept of potentially-nestable modality needs to be managed more than that, in one of a few ways but I’ve already rambled enough); after pressing Escape to close the popup, pressing Tab will reopen it as well as moving to the next focusable.
Hopefully the problems with this will be sorted out, but at present I think it’d be best to just remove the comparison, because it portrays a false picture, and suggests that the listbox is ready for use, whereas I hope that the author would agree it’s not.
Yeah this is actually a little scary:
https://nuejs.org/compare/faq.html
> No TypeScript: Nue embraces the dynamic typing in JavaScript
I for one have no desire to fight dynamic Javascript spaghetti any more. I personally think Typescript types aren't strong enough! (Too much `as Foo` around.)
> Amount of code needed for a rich, interactive web page.
And lists "Tailwind CSS" as 804k.
As a reminder, Tailwind CSS doesn't require or use JS in the browser at all and the majority of tailwind gets removed during build so the vast majority of the code you're attributing to Tailwind CSS is unrelated to the task of using Tailwind to build a rich interactive webpage.
To your point about inlining styles, using Tailwind out of the box I struggle to see how you're forced above 14kb, and if you really had kilobytes of classes in your markup you can switch to composing your own rules with @apply.
I recognize you are making a tool and not trying to do ecosystem wide benchmarks, but still suggesting you need 804kb to use Tailwind still seems disingenuous, or at least misinformed, to me.
> The component re-renders itself automatically after calling an event handler, but you need to call this manually if there is no clear interaction to be detected.
It is a creative approach to shed reactivity and just re-render after calling an event handler, and in some applications it can even be preferable to manage your own updates. But generally this seems like it will be rough and not enough in practice.
For very simple apps it might just work, but in rich interactive settings, it happens all the time that the whole point of interacting with one component is to affect the content in other components on the page. In those cases it can be a slog with this approach for the developer to have to manually keep track of which components need to be updated and traverse through and call update() in all the right places.
OTOH the need for really simple bits of interactivity does occur in real life. If the htmx [2] approach does not cu it, a micro-library like this could.
[2]: https://htmx.org/
This crossover is bound to happen, like it happened with jQuery. The question is when.
Look at Shoelace's code. It's just Web Components, coded in Typescript on top of lit.dev. It's about as easy to write as Vue.
> and aren’t polyfills
I know, hence the quotes on my text.
> Do we still need libraries like Vue?
No
> Haven't native web components reached the point where we can let go of the component "polyfills" we've been using?
Yes
I don't know how well a truly responsive design can be accomplished with visual tools only, to be fair.
I have almost a decade of React experience and to my ear this sounds very weird (starting from React/Vue put together casually). For me – React is really 7 hooks that provide usual abstractions and nothing more.
EDIT: I just looked through their listbox "code volume" comparison and it seems like a bad joke. Obviously meticulously type-scripting anything and exaggerating the code to the absolute will make it look BIGGER when compared to plain js file crafted to make it as thin as possible. I don't think it can stand a fair comparison though.
https://codesandbox.io/s/pedantic-mclaren-nqpjl5?file=/src/A...
As you can see it is 20 lines of code and zero hooks for React. It also takes a finite time to compute a limit > 2^10 without code sandbox complaining.
I wonder how much time Nue needs to render for limit=2^10? 2^100? Then we can compare.
Can you tell me at least if it is possible in Nue to create something functional like this and how? Or is it just a bunch of macro with some weird imperatives inside usual XML syntax?
I really want to see 4 lines of code doing the same thing 2x faster :D
Will people avoid adopting them because code won't be auto-generated efficiently?
It wouldn't be a barrier for me or many people that read hacker news, but I suspect there is a growing subset of the developer community for who this would be an issue.
If you're thinking, all we have to do is wait for OpenAI to re-scrape the web and re-train GPT on the new material, well... LLMs don't "learn" so much by looking at documentation, as by looking at examples. And a new tool is not going to have a lot of examples out there, simply by virtue of being new.
Aside, this is not going to stop people learning and using a language if it provides benefits. Not everyone is on the AI hype train. I personally couldn't care less - I don't trust any current AIs to write correct, bug-free code and so I just avoid them. Then again, I also don't trust most humans to write bug-free code and I tend to avoid them too. Formal verification should be the way forward, and this is why new languages, which can embed proofs, should continue being developed and improved, ignoring the AI hype.
When the AI can write code in formal verification languages, I might consider it.
The "Selfish Gene" strikes again.
Personally, I'm waiting for the space to settle, and for an offline, self-hosted and OSS version to reach feature parity with the proprietary SaaS offerings. Those might exist already, I'm not evaluating the options frequently, but I'm in no hurry.
On-topic: NueJS looks interesting. I'm very worn out and weary of shiny new JS frameworks, but I like the simplicity here. Will keep an eye on the project and consider it again once it matures, but for now Svelte is my best friend.
If you introduce a feature where someone writes
int i=0;
and the IDE goes, "Hey dude, probably writing a loop, should I manage that for you?" and it's C++ 17/20/23 or Rust or Go best practice and looks back a little bit in your code and in its compendium of great project examples to see what the loop logic should/could be...I would probably let the IDE write the loop header for me. And the string formatting. And modify the function I'm writing to support multithreading. And tell me it looks like I was trying to change each instance of pxX to pxY and graphX to graphY but also forgot to change one rotX to rotY.
Hell, if the IDE could read a PDF datasheet and automatically import addresses and bitfields and assign them to variable names, much of my current career workflow would be automated and I could focus mental effort on more creative work.
I have been using Java for a good decade now, and it solves all the business problems. Yes, we had an occasional Go/React threat (along JVM-based languages), but I have not seen it coming to a fruition. Java is mature, well supported and understood language that gets regular updates now. Some people don't like it, and that's okay.
What makes JS frameworks so quick to change? Angular, AngularJS, Next, Vue, React, Nue to name the few... What's the urge to reinvent rather than evolve?
young age of developers (average 25-34 years old.), who usually (not always of course) reinvent the wheel because they don't know the past and don't understand the tradeoffs.
Also, it's a way to get attention in this economy of virtue signaling, nobody gives a sh*t if you write a new C++ library that sends rockets into space, it's C++, it's insecure, you should have used Rust.
There’s a really low barrier to entry for creating and sharing JS packages. Basically, you can just create a free account on npm and run “npm publish” to make a library available globally for free. Updates are just as easy, and using packages is even easier.
It’s this super low-friction of JS development that drives the ecosystem to constantly iterate. And it even allows solo developers - like ^ this one - to publish and share a new framework.
I haven’t tried to publish packages for Java, Go, Python etc… but I would be very surprised if it’s as easy and unrestricted as npm…
How is Nue 10 – 100× smaller? [...] No TypeScript: Nue embraces the dynamic typing in JavaScript
I see the TypeScript backlash is in full swing!
I personally think TypeScript is (mostly) great and is the only thing that makes JS development bearable. But it's always good to see alternatives.
In my experience the best results are gained when they’re the same people. Splitting them up sounds like a recipe for disaster to me.
1. The page on server side rendering leads to a 404 https://nuejs.org/docs/nuejs/server-side-components.html
2. I hate JS projects that have a separate compile step-- preferring to just use the libraries directly (as a script import). Julia Evans also wrote about this some time ago. Im not sure if your library will work without a compile step? Can I just download a .js file and try it out without jumping thru npm install/build hoops?
[1] https://medium.com/javascript-scene/top-javascript-framework...
Please now provide a way avoid the need for npm and we can really start to move away from the dumpster fire that is react + npm.
>Bring back the power of cascaded styling
Welp, I'm out.
And now we have native nesting, wich was in old times a reason for use things like sass/scss/... CSS-Variables too, so theming is not a pain in the a.. anymore.
You can use overbloated frameworks, but i did not see a reason anymore for that. Especially when you develop component based. Tailwind on a top level is ok, but not within a component and child items, unnecessary complicated.