Minimal runtime for loading Uniweb foundations and orchestrating rendering.
This package provides the browser-side runtime for Uniweb sites. It loads foundations dynamically and renders content using React Router.
For Vite build plugins, see @uniweb/build.
npm install @uniweb/runtimeInitialize the runtime with a Foundation URL:
importinitRuntimefrom'@uniweb/runtime'// Load foundation from URLinitRuntime('/foundation/foundation.js',{development: import.meta.env.DEV,})// Or with CSSinitRuntime({url: '/foundation/foundation.js',cssUrl: '/foundation/assets/style.css'})Foundation imported directly and bundled with the site:
import*asFoundationfrom'@my-org/my-foundation'importinitRuntimefrom'@uniweb/runtime'initRuntime(Foundation)Initialize the runtime with a foundation.
source - One of:
- URL string to foundation module
- Object with
{ url, cssUrl } - Foundation module object (for static bundling)
options:
{development: false,// Enable dev mode (StrictMode, verbose errors)configData: null,// Site content (or reads from DOM)basename: undefined// React Router basename}For core classes (Uniweb, Website, Block, etc.), import from @uniweb/core.
@uniweb/runtime (browser)
│
├── Loads foundation dynamically
├── Creates Uniweb instance via @uniweb/core
└── Orchestrates React/Router rendering
Foundations should:
- Import components from
@uniweb/kit(bundled) - Mark
@uniweb/coreas external (provided by runtime)
Vite plugins have moved to @uniweb/build:
// vite.config.jsimport{siteContentPlugin}from'@uniweb/build/site'import{foundationDevPlugin}from'@uniweb/build/dev'exportdefaultdefineConfig({plugins: [siteContentPlugin({sitePath: './',inject: true}),foundationDevPlugin({path: '../foundation',serve: '/foundation'}),]})@uniweb/core- Core classes (Uniweb, Website, Block)@uniweb/kit- Component library for foundations@uniweb/build- Vite build pluginsuniweb- CLI for creating projects
Apache 2.0