Skip to content

Getting started

This is for self-hosting: you build or download stylist and run it yourself. If someone else already runs it for you and gave you an API URL and a token, see Getting started (hosted) instead.

Build from source (Go 1.26+):

Terminal window
make build # → dist/stylist

Or cross-compile release binaries for every platform:

Terminal window
make release # darwin/linux/windows × amd64/arm64 in dist/

stylist is a single static binary with no runtime dependencies.

Create a ruleset (see Rulesets for the full schema):

rules/brand.yaml
id: acme-brand-v1
colors:
allowed: ["#1A2B3C", "#FFFFFF"]
fonts:
allowed: [Inter, Georgia]
terms:
banned:
- term: cheap
reason: use "affordable"
required:
- term: ACME

Check a file:

Terminal window
stylist check -ruleset rules/brand.yaml page.html
FAIL page.html (ruleset: acme-brand-v1)
page.html:5 [colors] color #ff4136 is not in the allowed brand palette
page.html:10 [terms] banned term "cheap" found: use "affordable"

Exit codes are CI-friendly: 0 pass, 1 violations, 2 error.

Add a project config so nobody needs flags:

# .stylist.yaml (repo root, checked in)
ruleset: rules/brand.yaml

Install the pre-commit hook:

Terminal window
stylist hook install

Commits that stage HTML violating the ruleset are now blocked, with the violation list printed. If the repo already has violations, accept them as tracked debt first. See Baselines:

Terminal window
stylist baseline
  • Point the repo at a central server instead of a local ruleset file: Server.
  • Catch assets as agents generate them: Hooks & CI.
  • See conformance over time: Dashboard.