Parcel
Bundle Chassis CSS and JavaScript with Parcel — zero-config Sass detection and token resolution.
Parcel is a zero-configuration web application bundler that automatically installs language transformers as it detects them. This guide walks through a fresh project; if you already have Parcel set up, jump to Import Chassis.
Installation covers the moving parts — this is the lightest of the three bundler guides because Parcel's auto-detection eliminates most manual configuration.
Setup
This guide assumes Node.js is installed and you're comfortable in a terminal.
-
Create a project folder and initialize npm.
mkdir my-project && cd my-project pnpm init -
Install Parcel. Parcel is the only build dependency — it installs the Sass transformer automatically when it sees a
.scssfile.pnpm add -D parcel -
Install Chassis CSS and its tokens. Add the optional peer dependencies for the components that need them, or omit both and use
chassis.bundle.*which includes them.pnpm add @chassis-ui/css @chassis-ui/tokens pnpm add @floating-ui/dom vanilla-calendar-pro # optional
Project structure
Create the source folders and starter files:
mkdir -p src/js src/scss
touch src/index.html src/js/main.js src/scss/styles.scssThe result:
my-project/
├── src/
│ ├── js/
│ │ └── main.js
│ ├── scss/
│ │ └── styles.scss
│ └── index.html
├── package.json
└── pnpm-lock.yamlConfigure Parcel
Parcel itself needs no configuration file. The HTML page is the entry point, and Parcel follows the imports from there.
-
Fill in
src/index.html. Reference the stylesheet and the script directly — Parcel resolves both, compiles them, and rewrites the references at build time.<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Chassis CSS w/ Parcel</title> <link rel="stylesheet" href="scss/styles.scss"> <script type="module" src="js/main.js"></script> </head> <body> <div class="container py-large px-medium mx-auto"> <h1>Hello, Chassis CSS and Parcel!</h1> <button class="button primary">Primary button</button> </div> </body> </html>When Parcel sees the
.scssreference, it auto-installs the Sass transformer. To install it manually instead, runpnpm add -D @parcel/transformer-sass. -
Add the
startandbuildscripts topackage.json.{ "scripts": { "start": "parcel serve src/index.html --public-url / --dist-dir dist", "build": "parcel build src/index.html --dist-dir dist" } } -
Start the dev server.
pnpm startParcel opens a local server on
http://localhost:1234. The page won't be styled yet — the stylesheet and script still need to be filled in.
Import Chassis
Parcel needs a Sass entry point and a .sassrc.js config file that sets loadPaths so Sass can resolve token overrides from src/scss.
-
Create
.sassrc.jsin the project root. Parcel passes these options directly to Dart Sass.const path = require('path') module.exports = { loadPaths: [path.resolve(__dirname, 'src/scss')] // project token override } -
Fill in
src/scss/styles.scss. The token source resolves through_vendor.scssbefore the rest of Chassis processes its variables, so a single@usedirective is all that's needed.// Chassis CSS — token source resolves via the loadPaths entry in .sassrc.js @use "@chassis-ui/css/scss/chassis"; // Optional: settings overrides use the `with (...)` syntax // @use "@chassis-ui/css/scss/chassis" with ( // $enable-fluid-font-sizes: false, // $enable-component-shadows: true, // );The default token build (
chassis/docs) is resolved automatically. To switch to a custom token set, place a_chassis-tokens.scsson an earlierloadPathsentry — see Customize → Sass for details. -
Import the Chassis JS in
src/js/main.js. Floating UI and vanilla-calendar-pro are resolved through the bundler when needed.import * as chassis from '@chassis-ui/css'For smaller bundles, import only the required plugins:
import { Modal, Tooltip } from '@chassis-ui/css' -
Reload. With all files filled in, Parcel hot-reloads the page — the heading and button should now render with Chassis styling.
Build optimizations
Parcel automatically extracts CSS to a separate file when running parcel build. No additional configuration is needed for CSS extraction.
Next steps
These docs cover JavaScript integration, Sass customization, and bundle optimization for a Parcel-based Chassis project.
- JavaScript — using the JS plugins, the programmatic API, and event names.
- Customize → Sass — variable overrides and importing only the required partials.
- Customize → Optimize — keeping the Chassis output lean.