CDN
Summary
This docs site doubles as a CDN for the Soma distribution files.
Instead of copying the flatpack into your project, you can
reference the files directly from
soma.nware.io: one <link> and
one <script> and the full component library
is available.
Files
| File | What it is |
|---|---|
/cdn/soma.css | The complete stylesheet: every soma-* component, all three themes, density modes, the a11y layer. |
/cdn/soma.umd.cjs | UMD bundle for plain <script> tags. Sets window.Soma and runs auto-init on DOMContentLoaded — the drop-in for server-rendered portal pages. |
/cdn/soma.js | ESM build for <script type="module"> or bundlers consuming a URL import. Default-exports the Soma API. |
/cdn/*.map | Source maps for both JS builds; DevTools picks them up automatically. |
/cdn/soma.d.ts | TypeScript definitions for the whole Soma.* API — editors use them for autocomplete even in plain-JS projects. See Getting started. |
/cdn/cdn-sri.json | Published sha384 integrity hashes for this build's bundles. See Integrity below. |
/cdn/nware-soma.zip | The complete flatpack as a downloadable archive. See Download below. |
Download
If you'd rather vendor the files into your project (offline builds, air-gapped deployments, checked-in static assets), grab the flatpack archive instead of referencing the CDN:
| Archive | Contents |
|---|---|
nware-soma.zip/cdn/nware-soma.zip | Latest release. Extracts to a nware-soma-<version>/ folder containing soma.css, soma.js, soma.umd.cjs, both source maps, soma.d.ts (editor types), web-types.json + soma.code-snippets (IDE metadata; see Getting started), and the Apache 2.0 LICENSE + NOTICE (keep these two alongside the files when redistributing). |
/cdn/<version>/nware-soma-<version>.zip | The same archive under the version-pinned path, e.g. /cdn/0.1.0/nware-soma-0.1.0.zip. |
The archive contents are byte-identical to the loose CDN files,
so swapping between vendored and CDN delivery never changes
behaviour. This is the same dist/ flatpack the
nware-portal serves as static resources.
Latest vs pinned
| Path | Behaviour |
|---|---|
/cdn/soma.css | Latest. Always the currently deployed release. Cached for 5 minutes, so consumers pick up a new release quickly — and may also pick up breaking changes. Fine for internal tools that track Soma. |
/cdn/0.1.0/soma.css | Pinned. Version-stamped path, cached as immutable for a year. Use this in anything you don't redeploy alongside Soma. |
Version retention
Version-pinned paths are permanent: every released version is
archived in the repository (cdn-releases/) and
baked into each site image, so /cdn/<version>/…
keeps serving byte-identical files after later releases. Pin
versions (and their hashes below) with confidence; only the
un-versioned "latest" paths move. Each release's docs site is
also archived at
/archive/<version>/ alongside the live
site, so documentation matching your pinned version stays
browsable.
HTML
<!-- classic script tag (server-rendered pages) -->
<link rel="stylesheet" href="https://soma.nware.io/cdn/0.1.0/soma.css" />
<script src="https://soma.nware.io/cdn/0.1.0/soma.umd.cjs"></script>
<!-- or as a module -->
<script type="module">
import Soma from 'https://soma.nware.io/cdn/0.1.0/soma.js';
Soma.toast({ title: 'Hello from the CDN', appearance: 'success' });
</script>
Integrity (SRI)
For the version-pinned CDN files you can pin content hashes too; the browser then refuses the file if it ever differs from what you audited. The sha384 hashes for every version this CDN serves:
| Version | File | integrity |
|---|---|---|
| Loading… | ||
<link rel="stylesheet"
href="https://soma.nware.io/cdn/0.1.0/soma.css"
integrity="sha384-…"
crossorigin="anonymous" />
Pair integrity with the version-pinned
paths only: the un-versioned /cdn/… files change
on every release, so a pinned hash there would break on
purpose.
Notes
- CORS is open (
Access-Control-Allow-Origin: *), so ESM imports and source maps work from any origin. - Everything is served gzipped with correct MIME types (including
.cjsand.map). - Soma is zero-dependency: no jQuery, no framework, nothing else to load.
- The dev/test environment at
soma.dev.nware.ioserves the same layout for pre-release verification. - Prefer
npm install @nware/somawhen you have a bundler; see Getting started.