Installation
VSN.js works best when you can drop it into an existing SSR page. Use the CDN for the fastest setup, or use NPM if you’re bundling or extending it.
CDN (recommended)
<script type="module" src="https://unpkg.com/vsn/dist/index.min.js" auto-mount></script>
This auto-mounts when the DOM is ready and applies your behaviors.
NPM + bundler
npm i vsn
import { Engine } from "vsn";
const engine = new Engine();
engine.registerBehaviors(source);
engine.mount(document.body);
Use this approach if you want to register custom flags or attributes, or if you already have a bundler pipeline.
Auto-mount vs manual mount
- auto-mount: add the
auto-mountattribute on the script tag. - manual: import
Engineand callmountyourself.
Versioning
VSN.js is still evolving. Pin versions in production if you want stability:
npm i vsn@0.x
Notes from the creator
VSN isn’t a framework. It’s a lifestyle.