The magic script is two lines of HTML. Put them on any page and every HAX web component you write into that page loads itself from the HAX CDN, the moment it shows up. No build step, no imports, no configuration.

Copy and paste

Then use any tag in the component registry, more than 600 of them. Browse them, with demos, in the element portfolio.

A whole page

This is a complete web page. Save it as a .html file and open it in a browser.

Running right here

This page loads the same way. These characters are <rpg-character> tags; nothing on this page imports them.

How it works

  1. Detect. build.js watches the page for custom elements that are not defined yet.
  2. Look up. It finds each tag in wc-registry.json, which the ubiquity build writes for every element HAX publishes.
  3. Import. It imports that element's module from the CDN, unbundled, so a page only loads the elements it uses.
  4. Hydrate. The element defines itself and the tag comes alive.

This is how every HAX site, HAXcms and the HAX editor load so fast: small ES modules over HTTP/2 and 3, fetched on demand, cached by the browser and shared across pages. A HAXsite runs the same build.js from its own copy, and falls back to the CDN.

Read more