Build & run
CLI commands, output layout, and how to serve the built site.
From this repo
npm run build then npm run serve, or npm run deploy to do both. No need to install the package as a dependency.
In your own project
Add the package, then from your project root (where src/ lives):
npm install github:dmac780/coupled npx coupled build npx coupled serve
Or run both in one step:
npx coupled deploy
Add to package.json scripts:
{
"scripts": {
"build": "coupled build",
"serve": "coupled serve",
"deploy": "coupled deploy"
}
}Then npm run build, npm run serve, or npm run deploy. Serve uses a built-in Node server (default port 8080). Use npx coupled serve 3000 for another port, or set PORT=3000.
Base URL (subpath deployment)
If the site is served from a subpath (e.g. https://username.github.io/coupled/), set the base so every href="/coupled-docs/ and src="/coupled-docs/ in the output is rewritten (e.g. /coupled/docs).
npx coupled build --base_url=coupled npx coupled deploy --base_url=coupled
Also accepted: --base-url=coupled. Value can be with or without a leading slash.
BASE_PATH=/coupled npm run build # or BASE_URL=/coupled npm run build
Default is root (/); omit the flag or env for local or root deployment.
Output
Directory: dist/. Wiped each build except dist/.git if present.
Build order: (1) Clear dist/ except .git, (2) Copy src/static/ to dist/static/, (3) Scan all .c.html files and register components, (4) Resolve style and script bundles and write bundle files, (5) Build each page by merging mounts and rendering the template, (6) Write final HTML into dist/ according to path and underscore rules (see File types).
Serving with another server
Serve dist/ with any static server (e.g. npx http-server dist -p 8080). If you use http-server, avoid destination="public/..."; it reserves the name public. Use destination="static/css" and destination="static/js" instead.
npx http-server dist -p 8080 npx serve dist # or any static file server