
HMPL.js
Launched this week
Template language for displaying UI from server to client
55 followers
Server-oriented customizable templating for JavaScript. It is based on customizable requests sent to the server via fetch and processed into ready-made HTML. The language is integrated with JSON5 and DOMPurify. Alternative to HTMX and Alpine.js.
Hey Product Hunt! 👋
I, Anthony Max, am pleased to introduce a templating language that can reduce the size of your applications by a significant amount while maintaining the same interface.
If you have ever worked with HTMX or Alpine.js, you may have noticed that these modules are quite limited. The idea behind them is brilliant, but the implementation is not extensible. With this template language, we tried to create something in between them and EJS or PUG.
👀 How this project can be useful for you
Apply Server-Side Rendering, but without indexing by robots, regardless of the platform (It is Client-Side Rendering, but completely server-oriented)
A small application is not only a plus for less memory in GitHub or GitLab, but also a fast loading of the page by the customer of the build that weighs a couple of megabytes
Don't depend on the current DOM like in other modules, you can put the code in a separate file with the .hmpl extension and work there
⚙️ Features
Customizable: Send a custom request to the server when receiving the UI
Memory Preserving: Reduce file sizes on the client by several times
Generate thousands of DOM nodes from a single template: Work with large components not only on the server but also on the client
Protected from XSS attacks: Enable incoming server HTML sanitization with DOMPurify and work with it safely
📌 Examples of use:
Live demo
Repository with real projects
Sandbox
👀 Why is this launch important to us?
We implemented the functionality together for almost a year. We found the right syntax by trial and error. Today we see that this really has serious practical application, which is why people's feedback is so important to us ❤️.
What do you think about this template language? It will be interesting to know your opinion 🌱!
Thank you all!
@aanthonymax Curious how this compares to Astro’s rendering approach.
@masump I haven't tried it, but I think it's possible to integrate with it. Rendering is done on the client at HMPL, so there won't be any problems with Astro.
Postiz
Looking good, congrats on the launch!
@nevo_david Thanks, Nevo! It took a long time to prepare, but I think it turned out well.
Dryfta
Good launch!
I think this project is interesting. It looks like something like ejs, only somehow strange. Like, through blocks such as components. But maybe it's good.
Anyway, good luck!
@alex_ana Thank you!