Installation
vUX runs straight from its source files. Put the library where your page can reach it, point one script tag at it, and import the modules you need.
1. Get the library
Clone or download the repository from GitHub and serve its folder with your site, for example at /lib/vUX/. Nothing needs installing or building.
git clone https://github.com/VilsHub/vUX.git lib/vUXTip
For production, ./minify.sh in the repository writes a minified copy to dist/<version>/, with every file in the same place. Serve that folder instead; nothing else changes. It needs Node 18 or later.
2. Mark your script tag
vUX finds its own files from the module script on your page. That tag needs two attributes:
<script type="module" src="main.js" data-id="vUX" data-library-root="/lib/vUX/"></script>| Attribute | What it does |
|---|---|
data-id="vUX" | Marks the script tag vUX reads its settings from. |
data-library-root | The path (absolute or relative) to the vUX folder. Every stylesheet and asset a module needs is loaded from <library-root>/assets/. |
Warning
Without these two attributes the modules still load, but no stylesheet does, so widgets appear unstyled.
3. Import modules
Each module is one file named vUX-<module>.js and exports one constructor:
import { MessageBox } from "/lib/vUX/vUX-messageBox.js";
import { Store } from "/lib/vUX/vUX-store.js";
const box = new MessageBox();
box.initialize();
box.success("vUX is loaded");Importing any module also loads the core, so $$ and the helper functions are available as globals from then on. To use only the core utilities, import vUX-core.js.
Note
Run vUxModules in the browser console to list every module file you can import.
4. Serve over HTTP
ES modules do not load from file:// addresses. During development, any static server works:
python3 -m http.server 8000Next
Your first component builds a small reusable component from your own markup.