Getting started

This page is a quick introduction to some of Argot’s features. For package requirements, install options, and library entrypoints, see Installation.

Argot offers several useful features. Here are some places you might want to start.

Process a stylesheet #

To use the Argot CSS processor, first install the package, argot-css:

npm install --save-dev argot-css

Node.js 22.18+ is required. The CLI binary is argot.

Add this script to your package.json, adjusting the input and output filenames as needed:

{
  "scripts": {
    "argot": "argot styles/index.css dist/output.css"
  }
}

Run npm argot to execute the script.

Argot will:

  1. Inline local @imports (including mid-file imports)
  2. Run Stylelint (default recommended + Argot color-contrast, or your config)
  3. Minify with cssnano
  4. Write the result to the specified output file.

Example index.css:

@layer reset, base, theme, layout, modules;

@import 'reset.css' layer(reset);
@import 'base.css' layer(base);
@import 'variables.css' layer(theme);
@import 'layout.css' layer(layout);
@import 'modules/index.css' layer(modules);

Specify your custom lint config with the --lint-config parameter:

argot styles/index.css dist/styles.css --lint-config "./stylelint.config.js"

For a deeper look, see Processor.

Adopt semantic token names #

Generate an empty template of shared intent-based custom properties, then fill in values (usually from your primitives):

argot semantics ./styles/semantics.css
# or include extended-tier names:
argot semantics --extended ./styles/semantics-extended.css

Assign values:

:root {
  --text-primary: var(--gray-16);
  --bg-body: var(--gray-2);
  /* … */
}

Use semantic names in components:

.card {
  background: var(--bg-raised);
  color: var(--text-primary);
}

Browse the full vocabulary: Browse tokens. Read the model: Custom property structure.

3. Optional: generate a primitive palette #

Define seed colors as numeric OKLCH, then emit --name-1 … --name-16 scales:

{
  "version": 1,
  "seedColors": [
    { "name": "gray", "l": 0.6, "c": 0.015, "h": 250 },
    { "name": "brand", "l": 0.6, "c": 0.2, "h": 250 }
  ],
  "options": {
    "lightnessCurve": "inclusive",
    "chromaCurve": "weighted"
  }
}
argot palette ./palette.json ./styles/primitives.css

Existing output needs --force. Preview with --dry-run. Map those primitives into your semantic file from step 2.

Details: Palette generator.

4. Optional: start from a scaffold #

argot scaffold

Drops a layered CSS tree (entrypoint, reset, base, primitives/semantics hooks, modules). Fill values, then process the entry file. See Scaffold and Architecture.

Suggested npm scripts #

{
  "scripts": {
    "css": "argot styles/index.css dist/styles.css",
    "tokens": "argot semantics ./styles/semantics.css",
    "palette": "argot palette ./palette.json ./styles/primitives.css --force"
  }
}

Next reading #

This page drafted by AI and pending human revision.