Skip to main contentSkip to docs navigation

Chassis

Quick Start

View on GitHub

Create a repository of assets with chassis-assets init, build the output, add a file, copy the result into a project, and release a version.

Introduction

This guide takes you from an empty folder to a repository of assets, a built output and a first file of your own, and shows where a project picks the result up. The last sections name what your consumers read and release a version.

The repository is yours: chassis-assets init writes its baseline, and everything it writes is yours to change.

Prerequisites

The build needs Node.js and nothing else. The rest is for the repository and its workflows.

  • Node.js 22.12 or later.
  • Git and Git LFS, from git-lfs.com. Run git lfs install once on your machine. Fonts and raster images are Git LFS files.
  • npm or pnpm. The baseline names one of them in its README and its workflows.

Create the repository

Run init with the package and the folder the repository will be in:

Shell
npx @chassis-ui/assets init acme-assets --brand acme --app site:web mobile:ios,android

Each app of --app is a name and its platforms, web, ios or android, separated by commas. Without options the repository has one brand, main, and one app, site, on the web. This example has iOS and Android, so the command writes thirteen files and prints them:

TEXT
package.json                              -> The brands, the apps and the scripts
chassis.checks.json                       -> The files that consumers read by name, none yet
.gitattributes                            -> The Git LFS rules of the fonts and the images
.gitignore                                -> dist/, archives/, node_modules/
.nvmrc                                    -> The Node.js version of the workflows
README.md                                 -> The layout and the commands
CHANGELOG.md                              -> The notable changes of each release
AGENTS.md                                 -> The rules for AI coding agents in the repository
CLAUDE.md                                 -> Points Claude Code at AGENTS.md
.github/workflows/ci.yml                  -> Changelog, lint, build and verify on every push
.github/workflows/release.yml             -> Build, verify and archive a new version on main
.github/workflows/native.yml              -> Compile the release build with Xcode and Android tools
source/_default/_shared/other/readme.txt  -> A stand-in for the first asset

A repository with only the web has no native.yml, and twelve files. It writes nothing when one of them exists; --force writes over the files that exist, but never package.json, chassis.checks.json or CHANGELOG.md, which hold your data, and --dry-run prints them without writing. --name sets the package name, by default the name of the folder, and --pm pnpm makes the README and the workflows use pnpm. --repository, --license and --author set those fields of package.json, by default from the origin remote, MIT and the name of your git configuration.

A later version of the package writes other files. In a repository you already have, init --check reports where it differs from what the current version writes, and exits 1 when it does. init --only <file...> writes those files; add --force for one that exists.

Then go into the folder, make it a repository, and install the package. Commit the lockfile the install writes with the rest: the workflows install from it.

Shell
cd acme-assets
git init && git lfs install
npm install

Build the output

Run the build from the repository root. It reads the brands and the apps of the chassis block of package.json, and writes one folder per job.

Shell
npm run build

Use the options of the build to build a part of it, and --dry-run to see the jobs without writing a file. Each filter takes one or more values.

Shell
npx chassis-assets build --brand acme             # one brand
npx chassis-assets build --app site               # one app
npx chassis-assets build --platform ios android   # two platforms
npx chassis-assets build --dry-run                # print the jobs, write nothing

The build writes the output to dist/<platform>/<app>/<brand>/, and each of these folders holds one folder per type of the app. With the brand and the apps given above, and the stand-in file:

TEXT
dist/
├── android/
│   └── mobile/
│       └── acme/
│           └── other/
│               └── readme.txt
├── ios/
│   └── mobile/
│       └── acme/
│           └── other/
│               └── readme.txt
└── web/
    └── site/
        └── acme/
            └── other/
                └── readme.txt

dist/ is not committed. npx chassis-assets verify checks the output against the source and passes. The build system page describes every command and option.

Add a file

A file added to source/ is in the output of the next build. No list or configuration names it.

  1. Export the file from the design tool, named in lowercase with hyphens.
  2. Put it in source/_default/<app>/<type>/ when every brand gets it, or in source/<brand>/<app>/<type>/ when it belongs to one brand. Use _shared in place of <app> when every app gets it.
  3. Run npx chassis-assets lint-source to check the name, and npx chassis-assets build to build.
  4. Find the file in dist/, under the name of each platform.
  5. Commit the file of source/.
TEXT
source/
├── _default/             -> the default brand, used by every brand
│   ├── _shared/          -> the files of every app
│   └── <app>/            -> an app of the configuration
│       ├── fonts/
│       ├── icons/
│       ├── images/
│       └── <folder>/     -> any other folder is a type too
└── <brand>/              -> a brand: the files that differ
    ├── _shared/
    └── <app>/
        └── <type>/

A brand file replaces the default file of the same path, and a brand gets every default file that it does not replace. To give a brand a file of its own, add it to the folder of the brand under the same subfolder and name. A file that only a brand holds is in the output of that brand only.

Once a brand or an app has a file of its own, delete source/_default/_shared/other/readme.txt: it only stood in for the first build.

The design guidelines have the naming rules, and each type has a page: fonts, images, icons and other assets.

Use the output

A project reads the folder of one job. Copy it into the project, or point the project at it.

Shell
cp -R dist/web/site/acme/. /path/to/project/public/assets/

A project can also add the repository as a Git submodule and build it there. The repository needs nothing installed for that; the project installs the package and names the folder. --out is relative to that folder, so give it a path from the project:

Shell
npx chassis-assets build --cwd vendor/assets --out "$PWD/static/assets"

The page of each platform shows what the folder holds and how an app loads the files:

Name what consumers read

When an app or a site reads a file of the output by name, add it to chassis.checks.json, by job, with who reads it:

JSON
{
  "contracts": {
    "web/site/acme": [
      {
        "reader": "the layout of the site",
        "files": ["images/site-logo.svg", "fonts/fonts.css"]
      }
    ]
  }
}

npx chassis-assets verify then fails when a build no longer has the file, before a consumer does. The build system page describes the forms an entry takes.

Release a version

A release is a push to main with a new version in package.json. The first push to main releases 0.1.0, the version chassis-assets init writes. For a later release, raise the version without a tag, as the workflow makes the tag, add its entry to CHANGELOG.md, and push:

Shell
npm version 0.2.0 --no-git-tag-version
git commit -am "chore: release 0.2.0"
git push origin main

The release workflow stops when CHANGELOG.md has no entry for the version, and CI fails on it first. It builds and verifies every job, writes one acme-assets-<platform>-<app>-<brand>-0.2.0.zip per job with chassis-assets archive and the list of their files with chassis-assets manifest, and creates the tag v0.2.0 and the GitHub release with them attached and the entry as its body. A push whose version already has a tag releases nothing, and a release that fails makes no tag, so the next push to main tries again. An app takes the archive of its platform, app and brand from the release.

The workflows call the scripts of package.json, so a script can take options, such as chassis-assets build --optimize with sharp and svgo installed.

Troubleshooting

Each entry gives the message or the symptom, then the cause and the fix.

Files exist

init stops with Files to write exist in <dir>: <files>. --force writes over them. The folder already holds a file of the same name, such as the README or the .gitignore that GitHub wrote. Run init again with --force to write over them, or delete them first.

Build fails on pointers

The build stops with <count> source file(s) are Git LFS pointers, not files. The clone was made without Git LFS, so the fonts and the images are pointer files of a few lines. Install Git LFS, run git lfs pull, and build again.

Unknown brand

The build stops with Unknown brand "<name>". Configured: <names>. A filter names a brand, an app or a platform that the chassis block of package.json does not have. Use one of the names the message lists.

Missing output file

The build passes and a file of source/ is not in the folder of a job. The platform does not keep the format: a TTF font is not copied to the web, and a WebP image is not copied to iOS. The page of the type has a table of the formats each platform gets.

Next steps

Continue with one of these pages: