| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A Fast & Light Virtual DOM Alternative available for Node.js and NativeScript too.
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).
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].
No matter if you use ESM or CommonJS, you can use hypermorphic to load same features on both client and server.
// ESM example (assuming bundlers/ESM loaders in place)
import {bind, wire} from 'hypermorphic';
// CommonJS example
const {bind, wire} = require('hypermorphic');Following most important changes in version 2:
A proper documentation full of examples can be found in viperhtml.js.org.
The easiest way to describe hyperHTML is through an example.
// this is hyperHTML
function tick(render) {
render`
<div>
<h1>Hello, world!</h1>
<h2>It is ${new Date().toLocaleTimeString()}.</h2>
</div>
`;
}
setInterval(tick, 1000,
hyperHTML(document.getElementById('root'))
);IE9+ , iOS8+ , Android 4+ and every modern Mobile or Desktop Browser. You can verify directly through the following links:
If you are using Visual Studio Code you can install literally-html to highlight all literals handled by hyperHTML and 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 hyperhtml so that others can benefit from answers and examples.
You can read more on this hyperHTML vs lit-html comparison.
npm install hyperhtmlIf your bundler does not work with the following:
// ES6
import hyperHTML from 'hyperhtml';
// CJS
const hyperHTML = require('hyperhtml');You can try any of these other options.
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.
| Back | FazBrowse Home | New Git URL |