Skip to content

Commit 98fb3e1

Browse files
committed
add mu-js to the alternatives page
1 parent ab8fd69 commit 98fb3e1

1 file changed

Lines changed: 45 additions & 27 deletions

File tree

www/content/essays/alternatives.md

Lines changed: 45 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ tag = ["posts"]
1313
+++
1414

1515
[htmx](/) is only one of many different libraries & frameworks that take the
16-
[hypermedia oriented](@/essays/hypermedia-driven-applications.md) approach to building web applications. I have
16+
[hypermedia oriented](@/essays/hypermedia-driven-applications.md) approach to building web applications. I have
1717
said before that I think the [ideas of htmx](/essays) / [hypermedia](https://hypermedia.systems) are more important than
1818
htmx as an implementation.
1919

@@ -22,8 +22,9 @@ Here are some of my favorite other takes on these ideas that I think are worth y
2222
## Unpoly
2323

2424
[Unpoly](https://unpoly.com/) is a wonderful, mature front end framework that has been used heavily (especially in the
25-
ruby community) for over a decade now. It offers best-in-class [progressive enhancement](https://developer.mozilla.org/en-US/docs/Glossary/Progressive_Enhancement)
26-
and has many useful concepts such as [layers](https://unpoly.com/up.layer) and sophisticated
25+
ruby community) for over a decade now. It offers
26+
best-in-class [progressive enhancement](https://developer.mozilla.org/en-US/docs/Glossary/Progressive_Enhancement)
27+
and has many useful concepts such as [layers](https://unpoly.com/up.layer) and sophisticated
2728
[form validation](https://unpoly.com/validation).
2829

2930
I interviewed the author, Henning Koch, [here](@/essays/interviews/henning_koch.md)
@@ -32,14 +33,14 @@ You can see a demo application using Unpoly [here](https://demo.unpoly.com/).
3233

3334
## Triptych
3435

35-
[Triptych](https://github.com/alexpetros/triptych) is a set of [three proposals](https://alexanderpetros.com/triptych/)
36+
[Triptych](https://github.com/alexpetros/triptych) is a set of [three proposals](https://alexanderpetros.com/triptych/)
3637
to bring more generalized hypermedia controls directly into the HTML specification:
3738

3839
* Allow more [HTTP Methods](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) to be used directly from HTML
3940
* Allow buttons to act as stand-alone hypermedia controls
4041
* Allow hypermedia controls to target any element on the page for replacement
4142

42-
It is [in the process](https://github.com/whatwg/html/issues/3577#issuecomment-2294931398) of being introduced to the
43+
It is [in the process](https://github.com/whatwg/html/issues/3577#issuecomment-2294931398) of being introduced to the
4344
[WHATWG](https://whatwg.org/) for inclusion in the HTML specification.
4445

4546
The project includes a [polyfill](https://github.com/alexpetros/triptych/blob/main/triptych.js) that can be used today
@@ -49,7 +50,7 @@ to implement applications using the proposal today.
4950

5051
[fixi.js](https://github.com/bigskysoftware/fixi) is a minimalist implementation of
5152
[generalized hypermedia controls](https://dl.acm.org/doi/fullHtml/10.1145/3648188.3675127) by the htmx team, focusing
52-
on being as small as possible and [omitting](https://github.com/bigskysoftware/fixi#minimalism) many of the features
53+
on being as small as possible and [omitting](https://github.com/bigskysoftware/fixi#minimalism) many of the features
5354
found in htmx.
5455

5556
It is intended to be as small as possible (~3.5k unminified & uncompressed, ~1.3k compressed) while still being readable
@@ -58,79 +59,96 @@ and debuggable, so it can be included in a project directly without requiring an
5859
## Datastar
5960

6061
[Datastar](https://data-star.dev/) started life as a proposed rewrite of htmx in typescript and with modern
61-
tooling. It eventually became its own project and takes an [SSE-oriented](https://data-star.dev/guide/getting_started#backend-setup)
62-
approach to hypermedia.
62+
tooling. It eventually became its own project and takes
63+
an [SSE-oriented](https://data-star.dev/guide/getting_started#backend-setup)
64+
approach to hypermedia.
6365

64-
Datastar combines functionality found in both htmx and [Alpine.js](https://alpinejs.dev/) into
65-
a single, tidy package that is smaller than htmx.
66+
Datastar combines functionality found in both htmx and [Alpine.js](https://alpinejs.dev/) into
67+
a single, tidy package that is smaller than htmx.
6668

6769
You can see many examples of Datastar in action [here](https://data-star.dev/examples).
6870

6971
## Nomini
7072

71-
[Nomini](https://github.com/nonnorm/nomini) is a hypermedia implementation that embraces writing JavaScript in the original and intended way, as a simple enhancement to mostly-static pages. Its goal is to add a minimal layer of LoB on top of HTML to allow for powerful server-driven web apps with easily implemented client-side features. Additionally, it is currently the smallest library existing that gives both reactive variables and partial page swaps (~2.8k minified, ~1.4k minzipped).
73+
[Nomini](https://github.com/nonnorm/nomini) is a hypermedia implementation that embraces writing JavaScript in the
74+
original and intended way, as a simple enhancement to mostly-static pages. Its goal is to add a minimal layer of LoB on
75+
top of HTML to allow for powerful server-driven web apps with easily implemented client-side features. Additionally, it
76+
is currently the smallest library existing that gives both reactive variables and partial page swaps (~2.8k minified, ~
77+
1.4k minzipped).
7278

73-
In essence, Nomini is a tiny reimplementation of Datastar or a combination of Fixi and Alpine.js, intended to be a minimal, pragmatic building block for reactive server-driven UIs.
79+
In essence, Nomini is a tiny reimplementation of Datastar or a combination of Fixi and Alpine.js, intended to be a
80+
minimal, pragmatic building block for reactive server-driven UIs.
81+
82+
## µJS
83+
84+
[µJS](https://mujs.org/) is a small (~5k) dependency-free library that implements many hypermedia ideas and includes
85+
pre-fetching, SSE, idiomorph-based morphing and many other [great features](https://mujs.org/documentation).
7486

75-
## Alpine-ajax
7687

77-
Speaking of Alpine (which is a common library to use in conjunction with htmx) you should look at
78-
[Alpine AJAX](https://alpine-ajax.js.org/), an Alpine plugin which integrates htmx-like concepts directly into Alpine.
88+
## Alpine-ajax
7989

80-
If you are already an Alpine enthusiast, Alpine AJAX allows you to stay in that world.
90+
If you are a fan of [Alpine](https://alpinejs.dev/) (which is a common library to use in conjunction with htmx) you
91+
should also look at [Alpine AJAX](https://alpine-ajax.js.org/), an Alpine plugin which integrates htmx-like concepts
92+
directly into Alpine.
8193

8294
You can see many examples of Alpine AJAX in action [here](https://alpine-ajax.js.org/examples/).
8395

8496
## Hotwire Turbo
8597

8698
[Turbo](https://turbo.hotwired.dev/) is a component of the [Hotwire](https://hotwired.dev/) set of web development
87-
technologies by [37Signals](https://37signals.com/), of [Ruby on Rails](https://rubyonrails.org/) fame. It is a polished
88-
front end framework that is used heavily in the rails community, but can be used with other backend technologies as well.
99+
technologies by [37Signals](https://37signals.com/), of [Ruby on Rails](https://rubyonrails.org/) fame. It is a polished
100+
front end framework that is used heavily in the rails community, but can be used with other backend technologies as
101+
well.
89102

90103
Some people who have had a bad experience with htmx [have enjoyed turbo](https://news.ycombinator.com/item?id=42615663).
91104

92105
## htmz
93106

94107
[htmz](https://leanrada.com/htmz/) is a brilliant, tiny library that takes advantage of the fact that anchors and forms
95-
already have a [`target`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target) attribute that can target
108+
already have a [`target`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target) attribute that can target
96109
an `iframe`.
97110

98-
This, in combination with the `location hash`, is used to allow [generalized transclusion](https://dl.acm.org/doi/fullHtml/10.1145/3648188.3675127#sec-7).
111+
This, in combination with the `location hash`, is used to
112+
allow [generalized transclusion](https://dl.acm.org/doi/fullHtml/10.1145/3648188.3675127#sec-7).
99113

100114
This is the *entire* source of the library (I'm not joking):
101115

102116
```html
103-
<iframe hidden name=htmz onload="setTimeout(()=>document.querySelector(contentWindow.location.hash||null)?.replaceWith(...contentDocument.body.childNodes))"></iframe>
117+
118+
<iframe hidden name=htmz
119+
onload="setTimeout(()=>document.querySelector(contentWindow.location.hash||null)?.replaceWith(...contentDocument.body.childNodes))"></iframe>
104120
```
105121

106122
Amazing!
107123

108124
## TwinSpark
109125

110-
[TwinSpark](https://twinspark.js.org/) is a library created by [Alexander Solovyov](https://solovyov.net/) that is
126+
[TwinSpark](https://twinspark.js.org/) is a library created by [Alexander Solovyov](https://solovyov.net/) that is
111127
similar to htmx, and includes features such as [morphing](https://twinspark.js.org/api/ts-swap/#morph).
112128

113129
It is being [used in production](https://twinspark.js.org#who-is-using-this) on sites with 100k+ daily users.
114130

115131
## jQuery
116132

117-
Finally, good ol' [jQuery](https://jquery.com/) has the the [`load()`](https://api.jquery.com/load/#load-url-data-complete)
118-
function that will load a given url into an element. This method was part of the inspiration for
133+
Finally, good ol' [jQuery](https://jquery.com/) has the the [
134+
`load()`](https://api.jquery.com/load/#load-url-data-complete)
135+
function that will load a given url into an element. This method was part of the inspiration for
119136
[intercooler.js](https://intercoolerjs.org), the precursor to htmx.
120137

121138
It is very simple to use:
122139

123140
```javascript
124-
$( "#result" ).load( "ajax/test.html" );
141+
$("#result").load("ajax/test.html");
125142
```
143+
126144
and might be enough for your needs if you are already using jQuery.
127145

128146
## Conclusion
129147

130148
I hope that if htmx isn't right for your application, one of these other libraries might be useful in allowing you to
131-
utilize the hypermedia model. There is a lot of exciting stuff happening in the hypermedia world right now, and these
149+
utilize the hypermedia model. There is a lot of exciting stuff happening in the hypermedia world right now, and these
132150
libraries each contribute to that.
133151

134-
Finally, if you have a moment, please give them (especially the newer ones) a star on Github: as an open source
152+
Finally, if you have a moment, please give them (especially the newer ones) a star on Github: as an open source
135153
developer I know that Github stars are one of the best psychological boosts that help keep me going.
136154

0 commit comments

Comments
 (0)