CDN (recommended)
Add a single script tag. No build step, no install.
<!-- jsDelivr (multi-CDN, recommended) -->
<script src="https://cdn.jsdelivr.net/npm/@tltdsh/mx"></script>
<!-- unpkg -->
<script src="https://unpkg.com/@tltdsh/mx"></script>
This exposes four globals: mx, dom, define, components. You're ready to build.
Pinned version
Lock to a specific version:
<!-- jsDelivr -->
<script src="https://cdn.jsdelivr.net/npm/@tltdsh/mx@1.0.10/mx.min.js"></script>
<!-- unpkg -->
<script src="https://unpkg.com/@tltdsh/mx@1.0.10/mx.min.js"></script>
Without a version, the latest release is served automatically.
ESM (dynamic import from CDN)
One line, no install, no bundler:
const { mx, dom, define, components } = await import('https://cdn.jsdelivr.net/npm/@tltdsh/mx/mx.mjs')Works in any modern browser, Deno, or Bun.
npm / yarn / bun
npm install @tltdsh/mx
Use a bundler - the package exports work with Vite, Webpack, Rollup, esbuild:
import '@tltdsh/mx';
// mx, dom, define, components are now global
No tree-shaking needed
The entire library is 849 bytes brotli. There's nothing to shake.
Download
Grab the file and self-host:
Drop it next to your HTML:
<!DOCTYPE html>
<html>
<head>
<script src="mx.min.js"></script>
</head>
<body>
<script>
document.body.render(mx.h1('It works!'));
</script>
</body>
</html>Verify Installation
Open your browser console and type:
typeof mx // "function"
typeof dom // "function"
typeof define // "function"
components // {}If all four exist, mx.js is loaded and ready.
What You're Shipping
| File | Raw | Gzip | Brotli |
|---|
mx.min.js | 2.0 KB | 1,092 B | 849 B |
For comparison: React + ReactDOM is ~40KB min+gzip. Vue runtime is ~36KB. Preact is ~5KB. mx is 849 bytes.
No additional CSS, no runtime, no polyfills. One file, four globals, done.