Show HN: HMPL – Small Template Language for Rendering UI from Server to Client
github.comHi HN! Together with contributors, we've been making a small template language for a year now, which, in our opinion, can replace HTMX and Alpine.js. It is a mix between EJS and Handlebars, that is, you can make a request with a familiar syntax to the server in HTML right in the markup.
Requests are made via fetch and are configured via javascript almost entirely, which is what is needed today to work with the server.
The very essence of the template language comes down to minimizing the size of the bundle of the original web application by moving the components to the server and then storing them there. Thus, on the client we get a framework, where we insert components from the server brick by brick.
We showed this template language a long time ago, but it was not so mature then, so people had a lot of questions: https://news.ycombinator.com/item?id=41204552
Thank you very much to everyone for your attention! Please tell me what you think about the project? It will be interesting to know!
Reminds me of how facebook used to render html snippets on the backend and the frontend would just fetch that and update the DOM.
When you say it can replace htmx (which I’m using at the moment):
Isn’t this similar to htmx?
Like if I’m already using htmx, do I see benefits from switching?
Please correct me, but I’d rather frame HMPL, htmx and Alpine.js in the same camp?
So they are direct competitors and different flavors for the lightweight frontend approach.
But the main proposal of HMPL et al is to make people re-think if they need a huge and complex heavy frontend approach or if/when they should go for something lighter.
Hello! HMPL differs from HTMX quite seriously in that HTMX uses the outdated XMLHTTPRequest in requests, and is also almost not customizable at all. HMPL focuses on customization, which is done through more complete integration via JavaScript. It differs from Alpine.js in that it is a highly specialized tool, not a general one.
Alpine.js, HTMX and HMPL - represent the same idea (if we are talking about the server), but differ in details.
Is there a problem with XMLHTTPRequest?
When you say customizable: how? Can you give an example?
It's old. You can specify AbortController, for example.
Could you be more specific?