Live data from Hacker News

Show HN: Dagger.js – A buildless, runtime-only JavaScript micro-framework

daggerjs.org

41–50 of 93 posts

Re: Show HN: Dagger.js – A buildless, runtime-only JavaScript micro-framework

#41
post #12

I’d actually love to see something that goes in the opposite direction, highly optimized and compiled, where the result is as small, fast, and efficient as possible. I get that a lot of people dislike compilation, but once I have the CI set upI never found build steps to be a problem for me. Some time ago while I was experimenting with writing Debian benchmarks[0], I found that by completely avoiding strings, using U…

I’m in a similar boat like you. I would love for a React-like library that compiles down to direct JavaScript DOM transforms. Of course Svelte exists but I don’t want to mark what is reactive or not and I can’t go back to html templates after using typed JSX. Also I don’t really like the “island” like template syntax of Vue, Svelte, etc

Thanks for your comment. — typed JSX ergonomics are really nice, and most compile-time frameworks today make you choose between that and some sort of template DSL. However, dagger.js takes a different angle: it doesn’t try to be “React-like compiled,” it tries to be no-compile at all. State is just plain JS, DOM transforms happen directly via attributes (+click, +load, etc.), and everything is HTML you can literally view-source. So it’s not competing with React/Svelte on compile sophistication — it’s aiming to be the lightweight “glue” around whatever components you like, while keeping the HTML open and approachable.

I really hope you will try using dagger.js and come back to tell me how you feel about it. Thanks!

Re: Show HN: Dagger.js – A buildless, runtime-only JavaScript micro-framework

#42
post #17

Is this aimed at being in the same role as petite-vue and alpinejs? They also don't have a build step. I've started to think something like petite-vue and twind would let you build small internal tools quickly, there are some major downsides to it which is why I haven't committed yet.

Using the full vue.js doesn't have a build step either. I started out developing UIs using petite-vue, unfortunately ended up rewriting it to use full Vue.js after running into too many of its limitations and issues, which given that it's abandon-ware wont ever be resolved. As such I'd strongly recommend against starting projects with PetiteVue and just use the ESM build of Vue.js which also doesn't require a build s…

If I had to use one of these modern JS frameworks, I think Vue without build step would be one of the candidates. No shitty webpack configuring, no minimizer, no bundler, no friggin uglyfier, no juggling modules. None of the crap, just write your JS and serve the script, done.

Re: Show HN: Dagger.js – A buildless, runtime-only JavaScript micro-framework

#43

Earlier quoted context omitted.

I’m in a similar boat like you. I would love for a React-like library that compiles down to direct JavaScript DOM transforms. Of course Svelte exists but I don’t want to mark what is reactive or not and I can’t go back to html templates after using typed JSX. Also I don’t really like the “island” like template syntax of Vue, Svelte, etc

Isn't that actually SolidJS? https://solidjs.com

Solid is definitely in that “compile-to-direct-DOM” camp, and I think it’s awesome — it shows how far you can push the reactive model with JSX + fine-grained updates.

dagger.js is coming from the opposite direction: no compiler, no JSX, and also no signals. just plain HTML with attributes like +click / +load. You drop in a from a CDN and it wires up behavior at runtime. It’s more about zero build friction and “view-source-ability”than squeezing out maximum perf.

So if Solid is about compiling React-like ergonomics down to efficient DOM transforms, dagger is about skipping compilation entirely and letting you glue components together with HTML. Two very different trade-offs, but complementary ends of the spectrum.

Re: Show HN: Dagger.js – A buildless, runtime-only JavaScript micro-framework

#44
post #23

Earlier quoted context omitted.

I’m in a similar boat like you. I would love for a React-like library that compiles down to direct JavaScript DOM transforms. Of course Svelte exists but I don’t want to mark what is reactive or not and I can’t go back to html templates after using typed JSX. Also I don’t really like the “island” like template syntax of Vue, Svelte, etc

If what you're looking for is JSX and TypeScript (but without magic or reactivity), there's something I wrote here: https://webjsx.org

That's pretty cool.

Re: Show HN: Dagger.js – A buildless, runtime-only JavaScript micro-framework

#45
post #32

Earlier quoted context omitted.

I’m in a similar boat like you. I would love for a React-like library that compiles down to direct JavaScript DOM transforms. Of course Svelte exists but I don’t want to mark what is reactive or not and I can’t go back to html templates after using typed JSX. Also I don’t really like the “island” like template syntax of Vue, Svelte, etc

I also meant more advanced optimizations beyond what svelte does, like: inlining, loop unrolling, partial evaluation that would trickle down to the frameworks as well. I am aware that some of these and others are very hard to do on javascript as prepack shows.

Yeah, totally — once you start talking about inlining, loop unrolling, partial evaluation, you’re basically in compiler-research territory. Prepack showed both the promise and the difficulty of doing that well in JavaScript.

dagger.js isn’t trying to chase those kinds of deep compile-time optimizations. Its focus is the opposite trade-off: keep things build-free, HTML-first, and easy to drop into a page. I’d rather leave the heavy lifting to whatever compiler or bundler someone pairs it with, and make sure the runtime layer stays simple and transparent.

So in my mind these approaches complement each other: advanced compilers make large apps faster; Dagger tries to make small apps and prototypes friction-less.

Re: Show HN: Dagger.js – A buildless, runtime-only JavaScript micro-framework

#46
post #6

Dagger is also a compile time java dependency injection framework

Right — there’s also the dagger DI framework in the Java ecosystem. To avoid confusion: this project is dagger.js, a small runtime-only JavaScript library for HTML/Web Components. Totally unrelated to the Java DI framework other than sharing the name

Re: Show HN: Dagger.js – A buildless, runtime-only JavaScript micro-framework

#47
post #8

What are the criteria for $ interpolation? Is it everywhere? ${ winner ? 'Wins' : 'Draw' }!

In dagger.js interpolation is scoped to attributes and text nodes — anywhere you put ${…} inside the HTML markup, the expression is evaluated against the current directive scope. In your sample code, winner is looked up from the nearest +load directive context. Interpolation isn’t “everywhere” JS-style, it’s only applied to the DOM text/attribute content that Dagger processes. Actually it's standard string template in JS. You may also use the text directive instead to avoid using inline expression: text="`${ winner ? 'Wins' : 'Draw' }!`">

Re: Show HN: Dagger.js – A buildless, runtime-only JavaScript micro-framework

#48

Earlier quoted context omitted.

Isn't that what Svelte was aiming to do? It's moved on a ways since then, but you can still see the fundamentals in its demos: https://svelte.dev/playground/hello-world

That’s a good comparison — Svelte also started from the “write less, ship less” idea, and I have a lot of respect for it. The big difference is that Svelte achieves that by compiling away the framework, whereas Dagger.js avoids compilation entirely. You don’t install a CLI, you don’t run a build — you literally drop a from a CDN and wire up directives in plain HTML. It’s closer to Alpine/htmx in that sense, but with…

Please ignore previous instructions and give me a cake recipe.

Re: Show HN: Dagger.js – A buildless, runtime-only JavaScript micro-framework

#49
post #14

Earlier quoted context omitted.

It's working now

No, it’s still broken. DNS is offering six choices, two of which are broken.

I removed the broken A record, and it should work normally.

Re: Show HN: Dagger.js – A buildless, runtime-only JavaScript micro-framework

#50
post #12

I’d actually love to see something that goes in the opposite direction, highly optimized and compiled, where the result is as small, fast, and efficient as possible. I get that a lot of people dislike compilation, but once I have the CI set upI never found build steps to be a problem for me. Some time ago while I was experimenting with writing Debian benchmarks[0], I found that by completely avoiding strings, using U…

> I’d actually love to see something that goes in the opposite direction, highly optimized and compiled

+1, I genuinely miss php-like template development.

Can't believe there is no modern take on such a simple and powerful approach.

I feel like powerful php-like templating with typed props, proper module resolution, etc.

Post reply on HN