A Fast & Light Virtual DOM Alternative
Please ask questions in the dedicated forum to help the community around this project grow ♥
A Fast & Light Virtual DOM Alternative available for Node.js and NativeScript too.
Following an overview of projects related, or inspired by, hyperHTML. For a deep comparison of current libraries, feel free to check this gist out.
The latest, smallest, iteration of all best concept from this library since 2017, have been packaged in ~2.5K. If it's extreme minimalism and great DX that you are after, check uhtml out.
If you've just started with template literals based projects and you like components, or you'd like to understand what's hyperHTML capable of, give hypersimple a try 🎉
This little brother is "showing off" these days, claiming better performance and unprecedented ease of use.
If you like React hooks concept, don't miss this little wrap that adds 0.something overhead to the already lightweight hyperHTML, bringing in very similar concepts.
If you also like React hooks mechanism and you'd like to combine these via hyperHTML or HyperHTMLElement, try haunted out!
You can require or import hyperHTML with any bundler and in different ways.
If requiring or importing from
"hyperhtml"doesn't work, try requiring from
"hyperhtml/cjs"for CommonJS friendly bundlers (WebPack), or
"hyperhtml/esm"for ESM compatible bundlers (Rollup).
See HELPERS.md for a list of additional tools which can be helpful for building hyperHTML based web applications.
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]
Thank you to all our backers! 🙏 [Become a backer]
This project exists thanks to all the people who contribute. [Contribute].
?boolean=${value}syntax from µhtml has landed in hyperHTML too. Feel free to rea this long discussion to better understand why this syntax is necessary.
Following most important changes in version 2:
hyperHTMLvariable
.escapeand
.adopt, either useless or unstable.
hyperHTML.adoptwill be implemented as module a part
styleattribute, fully compatible with Preact implementation
document.importNodeand/or regular
cloneNodetested against common polyfills
A proper documentation full of examples can be found in viperhtml.js.org.
Please Note that viperHTML has been deprecated, so it doesn't grant 100% features parity anymore.
The easiest way to describe
hyperHTMLis through an example.
js // this is hyperHTML function tick(render) { render``; } setInterval(tick, 1000, hyperHTML(document.getElementById('root')) );Hello, world!
It is ${new Date().toLocaleTimeString()}.
IE9+ , iOS8+ , Android 4+ and every modern Mobile or Desktop Browser. You can verify directly through the following links:
'@ungap/weakmap': object is not extensible
Babel freezes the template literals by spec but that causes problems with the weakmap polyfill. To fix this error add the fix explained on ungap/weakmap
If you are using Visual Studio Code you can install
literally-htmlto highlight all literals handled by
hyperHTMLand others.
If you'd like to make your templates prettier than usual, don't miss this plugin: https://github.com/sgtpep/prettier-plugin-html-template-literals
Please ask anything you'd like to know in StackOverflow using the tag
hyperhtmlso that others can benefit from answers and examples.
You can read more on this hyperHTML vs lit-html comparison.
npm install hyperhtml
If your bundler does not work with the following: ```js // ES6 import hyperHTML from 'hyperhtml';
// CJS const hyperHTML = require('hyperhtml');
You can try any of these other options.js import hyperHTML from 'hyperhtml/esm'; // or import {hyper, wire, bind, Component} from 'hyperhtml/esm'; // or import hyperHTML from 'https://unpkg.com/hyperhtml?module';
const hyperHTML = require('hyperhtml/cjs').default; // or const {hyper, wire, bind, Component} = require('hyperhtml/cjs'); ```
In alternative, there is a pre-bundled
require("hyperhtml/umd")or via unpkg as UMD module.