Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Jadelet is a tiny clientside templating library that compiles Jade-like markup into DOM-building JavaScript.
Jadelet is a minimal clientside templating library that compiles Jade-like markup into plain JavaScript DOM-building code, weighing under 5.8kb and running anywhere JavaScript runs.
Jadelet is an open-source (MIT-licensed) clientside templating library that takes templates written in a Jade-like syntax—where tags and attributes map directly to HTML—and compiles them into JavaScript functions that produce DOM nodes. Instead of rendering HTML strings, Jadelet builds elements using native DOM APIs, so the output is already live DOM you can append to the page. The library is small (under 5.8kb) and has been used in production for years by glitch.com, whimsy.space, and danielx.net.
h1 @title to create an h1 element whose text content comes from the title property of the data passed to the template function.@click and automatically attached.HTMLElement or Node instances built with createElement and similar APIs—no intermediate HTML strings or innerHTML parsing.textContent, user-provided values cannot inject markup, making the library safe against cross-site scripting without extra sanitization.jadelet command converts .jadelet files to JavaScript, with options like -d for directories, --exports for custom module exports, and --runtime for browser globals.require() them with webpack, browserify, or any bundler.button(@click) Say Hey into a function that takes a click handler and returns a ready-to-attach button element.@-prefixed attributes to wire up event listeners at creation time—no separate addEventListener calls needed..js modules with the CLI and require() them in your app, letting webpack or other bundlers handle dependencies.Install with npm install jadelet, then run node_modules/.bin/jadelet -d templates to compile every .jadelet file in the templates directory into a .js file. Each compiled file exports a function that takes a data object and returns a DOM element. For single-file use, the CLI also accepts templates on stdin: echo "h1#title @title" | jadelet prints the compiled JavaScript to stdout.
Yes. Jadelet uses native DOM APIs to write string output as text nodes, so values passed to templates are interpreted as text, not HTML. This prevents injection attacks without requiring manual escaping.
Pass an HTMLElement (or any descendant of window.Node) as a value in your data object. Jadelet detects the type at runtime and inserts the element directly into the DOM instead of serializing it as text.
Yes. Jadelet has been used in production for years by glitch.com, whimsy.space, and danielx.net, and the project is MIT licensed and open source.
Jadelet builds DOM nodes directly, avoiding string parsing and innerHTML overhead. The FAQ notes you can always drop down to native DOM APIs for pieces that need special optimization.
Templates must have a single root element—multiple roots will cause compilation to fail. The library is also focused on clientside DOM rendering and does not include server-side rendering features out of the box.
