Browser Global
Ornata ships a browser-ready global build, which means you can use it directly in server-rendered, CMS-driven, or otherwise HTML-first pages without a bundler.
Load the global build
Section titled “Load the global build”Use a pinned version in production.
<script src="https://cdn.jsdelivr.net/npm/ornata@0.2.0/dist/index.global.js"></script><script> const { defineComponent, createInitializer, isComponent } = window.Ornata;</script>The same build is also available on UNPKG:
<script src="https://unpkg.com/ornata@0.2.0/dist/index.global.js"></script>Define a component in the browser
Section titled “Define a component in the browser”<script> const { defineComponent } = window.Ornata;
const Counter = defineComponent({ name: "Counter", state: { count: { default: 0 }, }, });
Counter.mount("[data-counter]");</script>Why this matters
Section titled “Why this matters”This is a strong fit for:
- server-rendered sites
- prototypes
- CMS-driven pages
- pages that want focused interactivity without a separate app build step
A good mental model
Section titled “A good mental model”If you already have HTML on the page and want to layer interaction onto it, the browser global build keeps the setup extremely small.