Lädt...

🔧 We build HMPL to help developers make web apps smaller in size🔥


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

Today, trends in website creation are changing. With the advent of Next.js, most developers have started using the concept of SSR (Server-Sider Rendering), which allows generating dynamic markup directly on the backend. But since this practice is architectural due to the fact that it is a framework, you will not be able to combine it normally, for example, if your site is already written in Vue.

The microfrontend concept helps in this regard, but again, for budget development this is too expensive a scheme, so in order to painlessly implement SSR (without robots), this template language was developed.

HMPL

HMPL is a template language that complements regular HTML with request objects. That is, you can describe directly in the markup what API path you want to get the component.

import hmpl from "hmpl-js";
// We create a constructor function
// that will generate instances to receive our elements.
const templateFn = hmpl.compile(
  `<div>
    <h1>
      {
        {
          src: "http://localhost:8000/api/getTitle"
        }
      }
    </h1>
  </div>`
);
// Generate an instance and get an element from it
const content = templateFn().response;
// Mounting our element into the DOM
document.querySelector("#app").append(content);

Example App

Using this module, a gallery application was created that implements dynamic content delivery on the server.

// Detect dark theme var iframe = document.getElementById('tweet-1881332519859319143-645'); if (document.body.className.includes('dark-theme')) { iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1881332519859319143&theme=dark" }

The example itself is located in the GitHub repository here.

Size comparison

Let's compare the code of two applications with the same UI and look at their size:

Size comparison between HMPL App and Vue App <br>
(or can be any popular framework or library)

As we can see, the HMPL clicker has a smaller file size than the same Vue clicker interface.

Installation

  • Node Package Manager: You can download it via npm using the command npm i hmpl-js

  • Content Delivery Network: You can include a file with a dependency via CDN using the following code:

<script src="https://unpkg.com/json5/dist/index.js"></script>
<script src="https://unpkg.com/hmpl-js/dist/hmpl.min.js"></script>
  • Locally: Or, there is a similar option with the second one, just download the file to your local machine.

Feedback

You can write your thoughts about the module in the comments, it will be interesting to read! Or, there is a thematic discord channel for questions and suggestions, there I or someone else will try to answer!

This project is Open Source

So you can take part in it too! This also means you can use it for commercial purposes:

Repo: https://github.com/hmpl-language/hmpl
Website: https://hmpl-lang.dev

It would be great if you supported the project with your star!

Thank you for your attention!

Thanks!

...

🔧 🎙️We build HMPL to help developers make web apps smaller in size🔥


📈 80.85 Punkte
🔧 Programmierung

🔧 We build HMPL to help developers make web apps smaller in size🔥


📈 80.85 Punkte
🔧 Programmierung

🔧 🔥We build HMPL to help developers make web apps smaller 🗄️ in size


📈 80.85 Punkte
🔧 Programmierung

🔧 🎙️We have implemented new features in HMPL to help developers make web apps smaller in size🔥


📈 76.03 Punkte
🔧 Programmierung

🔧 🎙️We've implemented new features in HMPL to help developers make web apps more secure🔥


📈 51.09 Punkte
🔧 Programmierung

🔧 🎙️We have implemented new features in HMPL to make developers' web apps more secure🔥


📈 44.72 Punkte
🔧 Programmierung

🔧 How to reduce javascript file size on client using HMPL?


📈 35.22 Punkte
🔧 Programmierung

🍏 3 Ways to Make iPhone Pictures a Smaller File Size


📈 31.17 Punkte
🍏 iOS / Mac OS

📰 Microsoft Plans to Make Monthly Windows 10 Updates Smaller in Size


📈 31.17 Punkte
📰 IT Security Nachrichten

📰 Microsoft Plans to Make Monthly Windows 10 Updates More Smaller in Size


📈 31.17 Punkte
📰 IT Security Nachrichten

📰 The smaller the business, the smaller the focus on cybersecurity


📈 28.27 Punkte
📰 IT Security Nachrichten

🍏 iPhone 17 Plus Screen Size Might Be Smaller Than Current Plus Variant, Says Report


📈 24.93 Punkte
🍏 iOS / Mac OS

🪟 Razer's Seiren Mini delivers pro sound in a smaller size for just $50


📈 24.93 Punkte
🪟 Windows Tipps

🐧 What happen when you write a file smaller than the chunk size in a RAID ?


📈 24.93 Punkte
🐧 Linux Tipps

🔧 📢 HMPL v3.0: New big update!


📈 24.43 Punkte
🔧 Programmierung

🔧 HMPL.js on DevHunt!🔥


📈 24.43 Punkte
🔧 Programmierung

🔧 ❄️Introducing the HMPL Template Language


📈 24.43 Punkte
🔧 Programmierung

🔧 🌷Creating a Gallery App in JavaScript with HMPL


📈 24.43 Punkte
🔧 Programmierung

🔧 🌷Creating a Gallery App in JavaScript with HMPL


📈 24.43 Punkte
🔧 Programmierung

🔧 🔥Introducing the HMPL VS Code Extension


📈 24.43 Punkte
🔧 Programmierung

🔧 🔥Introducing the HMPL VS Code Extension


📈 24.43 Punkte
🔧 Programmierung

🔧 🔥Introducing the HMPL VS Code Extension


📈 24.43 Punkte
🔧 Programmierung

🔧 HMPL integration with JSON5


📈 24.43 Punkte
🔧 Programmierung

🔧 🐜 Since CSS has changed the logo, it's time for HMPL to change the logo too!


📈 24.43 Punkte
🔧 Programmierung

🔧 🔥HMPL — best alternative to HTMX


📈 24.43 Punkte
🔧 Programmierung

🔧 HMPL - best alternative to HTMX


📈 24.43 Punkte
🔧 Programmierung

🔧 Differences between HMPL and HTMX


📈 24.43 Punkte
🔧 Programmierung

🔧 HMPL - new template language for fetching HTML from API


📈 24.43 Punkte
🔧 Programmierung

🔧 How to work with .hmpl file extension in javascript?


📈 24.43 Punkte
🔧 Programmierung

🪟 Surface Duo emulator updated to help developers make better apps


📈 23.15 Punkte
🪟 Windows Tipps