Commands
Run these in a terminal inside the source folder, after npm install (once).
| Command | What it does | Result |
|---|---|---|
npm run dev | Builds everything, then rebuilds whenever you save a file in src/, and serves it at http://localhost:3000. | dist/ |
npm run build | Builds every demo and the overview page, with formatted HTML. | dist/ |
npm run site -- <demo> | Builds one demo as a finished website: pages at the top level, no demo or colour switcher. | site/ |
npm run validate | Checks the built HTML for mistakes (npm run validate -- <demo> for one demo). | A report |
Options for the build script#
You can also run the build script directly:
BASH
# only rebuild some demos (faster)
node build.js --only cafe,hotel
# skip formatting the HTML (faster while working)
node build.js --no-format
# use another port for the dev server
PORT=4000 npm run devOn Windows PowerShell, set the port with $env:PORT=4000; npm run dev.
Where things end up#
dist/: every demo in its own folder, the overviewindex.htmlandassets/. Rebuilt bybuildanddev.site/: one demo, ready to upload. Rebuilt bysite.
Never edit files in dist/ or site/ directly when using the source files; they're overwritten on the next build. Edit src/ instead.