Engine and CLI
Command line
The jx CLI sets up a project, compiles the classes it finds and watches your sources.
Every command runs from the project root with dart run jx_cli:jx.
jx init
Creates a commented jx.yaml. Refuses to overwrite an existing file unless
--force is passed.
dart run jx_cli:jx init
| Option | Role |
|---|---|
-f, --force |
Overwrites an existing jx.yaml. |
jx build
Scans the sources, compiles the classes it finds and writes the stylesheet.
dart run jx_cli:jx build
| Option | Role |
|---|---|
-c, --config |
Configuration file (default: ./jx.yaml when it exists). |
-i, --input |
Class expression to compile directly, without scanning. |
--content |
Files or folders to scan; replaces content from jx.yaml. |
-o, --output |
Path of the generated CSS file (default: web/jx.css). |
-m, --minify |
Minifies the output CSS. |
--[no-]reset |
Includes the preflight or not. |
-w, --watch |
Rebuilds on every change to the sources. |
Compile an expression
With --input, the CLI compiles the given classes and prints the CSS, without reading your files:
dart run jx_cli:jx build -i "p:4 hover:c:blue"
.p\:4 {
padding: 1rem;
}
.hover\:c\:blue:hover {
color: #3b82f6;
}
Class extraction
The CLI only reads the string literals of your files: every word that follows the JX syntax and matches a rule becomes a class. Words that match nothing are ignored.
Dynamic classes
Always write classes in full. A class built by interpolation, such as 'c:${color}', cannot be found: use a map of complete literals instead.