Engine and CLI

Build and watch mode

One build for production, a watcher for development. Both read the same jx.yaml and only compile the classes found in your sources.

One build

dart run jx_cli:jx build

The CLI scans the content folders for the configured extensions, extracts the classes from string literals, compiles them and writes output (web/jx.css by default). It prints the number of rules and the time taken.

Watch mode

dart run jx_cli:jx build -w
  • A first build runs right away.
  • Every content folder is watched recursively; only files with a configured extension trigger a rebuild.
  • Changes are grouped: the build starts 150 ms after the last save, so saving many files rebuilds once.
  • The output file itself is ignored, so the watcher never loops.
  • A failing build is reported and the watcher keeps running.

One terminal

Inside jaspr serve, the build_runner builder can replace the watcher. See Automatic builds.

Production

Minify the stylesheet before deploying:

dart run jx_cli:jx build -m

In continuous integration, run the same command before jaspr build, so the deployed stylesheet always matches the sources.

Warnings

A word that looks like a JX class but matches no rule is reported, with the closest known class when there is one. Values rejected for security reasons are reported too, and never reach the stylesheet.

Output
Warning: Unknown class "pd:4": did you mean "p:4"?
Warning: "c:bleu" ignored: Invalid value "bleu" for "c". Did you mean "c:blue"?