Eleventy Plugin Baseline

A magic carpet ride

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.json is ESM ("type": "module").
  • Install dev dependencies: npm install rimraf npm-run-all cross-env.

Steps

  1. Install helper packages:

    npm install rimraf npm-run-all cross-env
  2. Add scripts to package.json.

    Ensure 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"
    	}
    }
  3. Run local dev with clean output:

    npm run start
    • Runs clean (removes dist/), then dev server.
  4. Run production build:

    npm run build
    • Runs clean, then build:eleventy with ELEVENTY_ENV=production.
  5. 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 change dir.output.
  • npm-run-all sequences clean → dev/build; keep clean first so stale artifacts don’t leak into builds.
  • cross-env sets ELEVENTY_ENV=production portably.