Show HN: I made a HTMX Playground 100% in the browser (opens in a new tab)lassebomh.github.io
482 pointsI recently dug up an old project in an attempt to improve on it. It's a code sandbox for playing around with HTMX in the browser, that runs a mock server within the sandbox iframe. The server "framework" is loosely based on Django, so if you're familiar with Django, you'll immediately understand what's going on.
I recommend clicking through the examples.
Github repo: https://github.com/lassebomh/htmx-playground
Probably my favorite part is the lack of HTMX specific code. It's designed to mimic the client and server, but really nothing else. In principle, this means that it is agnostic to whatever frontend framework is being used.
Known problems: Limited mobile support, Ace Editor (should just be Monaco) and lack of proper error outputs.
Feel free to give feedback, suggestions or questions.
I learned a lot when making it, and I hope you'll something about HTMX! Happy tinkering.
Comments (118) 19 threads
Show all comments
Showing thread 1 of 19
In which, you still need to include a JS file. I'd still count that as Javascript.
Continue this thread — 1 reply
Is there a way to use HTMX with minimal server side changes. Specifically if I have an existing page that you fill in a form and submit and response is of course the entire page. I think it would be cool to tell htmx that the whole page is being returned BUT I only want to update #my-form and that way you don’t need any “if htmx request” kinda stuff on the server.
This is for people who care about their site working without JS. But also it allows you to have a single backend endpoint to handle multiple things (for example comments, sign up to email, like button, all in one)
- https://htmx.org/attributes/hx-select/ - https://htmx.org/attributes/hx-target/
Continue this thread — 1 reply
I played with it recently and it was pretty easy to enhance a completely non-js CRUD type app and have it fall-back gracefully. Seems a similar concept to HTMX but has a more batteries included / high-level approach.
https://htmx.org/extensions/multi-swap/
That'll return whatever partial thing you want to return and replace (with 1sec effect).
this makes htmx more work, in general, to accomplish things but also less opaque
htmx is laser focused on generalizing hypermedia controls in HTML (anchors & forms)