Documentation — Table of Contents
Baseline Build Scripts and Cleanup
Set up clean dev/build scripts using npm-run-all, rimraf, and cross-env so your Baseline builds are predictable across platforms.
Prerequisites
- Baseline installed;
package.jsonis ESM ("type": "module"). - Install dev dependencies:
npm install rimraf npm-run-all cross-env.
Steps
-
Add scripts to
package.jsonEnsure these are present:
{ "scripts": { "start": "npm-run-all clean dev", "clean": "rimraf dist/", "dev": "npx @11ty/eleventy --serve", "build:eleventy": "cross-env ELEVENTY_ENV=production npx @11ty/eleventy", "build": "npm-run-all clean build:*", "dryrun": "npx @11ty/eleventy --dryrun" } } -
Run local dev with clean output
npm run start- Runs
clean(removesdist/), thendevserver.
- Runs
-
Run production build
npm run build- Runs
clean, thenbuild:eleventywithELEVENTY_ENV=production.
- Runs
-
Optional: dry run
npm run dryrun- Inspect what would be built without writing files.
Notes
rimraf dist/keeps output clean across platforms; adjust the path if you changedir.output.npm-run-allsequences clean → dev/build; keepcleanfirst so stale artifacts don’t leak into builds.cross-envsetsELEVENTY_ENV=productionportably.
Previous: Integrate Baseline with Eleventy Base Blog
Next: Modules