Engine and CLI
Architecture
One package, jx_cli, made of separate tested libraries, each responsible for one step of the pipeline. Use the engine alone, replace the theme or add your own rules.
The pipeline
A string of classes goes through four steps: the parser splits it into tokens, the registry finds the rule for each utility, the theme resolves named values and the generator writes the CSS.
"md:hover:bg:blue!"
-> parser token: variants [md, hover], bg, blue, important
-> rules background-color rule
-> theme blue = #3b82f6
-> engine selector .md\:hover\:bg\:blue\!:hover inside @media (min-width: 768px)
-> generator final CSS
md
:
hover
:
bg
:
blue
!
@media (min-width: 768px) {
.md\:hover\:bg\:blue\!:hover {
background-color: #3b82f6 !important;
}
}
The libraries
-
01
package:jx_cli/core.dartShared contracts and models: class tokens, CSS rules, configuration, value validation.
-
02
package:jx_cli/parser.dartParses the [variants:]utility[:value][!] syntax, explains every rejection and blocks values able to inject CSS.
-
03
package:jx_cli/theme.dartTheme tokens (colors, spacing, breakpoints…), extensible through configuration.
-
04
package:jx_cli/rules.dartThe utility catalog and its registry: each rule produces declarations.
-
05
package:jx_cli/engine.dartRuns the pipeline and applies variants, sorted mobile-first. Also the Tailwind converter.
-
06
package:jx_cli/generator.dartSerializes the CSS, minified or not, after the preflight.
-
07
jx (command)jx build, jx init and jx migrate: class extraction from Dart files, watch mode.
-
08
package:jx_cli/builder.dartbuild_runner integration: jaspr serve and jaspr build write the stylesheet.
-
09
package:jx_cli/ui.dartAccessible Jaspr components styled with JX classes.
Rule ordering
The engine sorts the stylesheet mobile-first: rules without a media query first, then breakpoints by increasing width. An
md: class therefore always wins over the same property without a variant.
Note
Design decisions (pseudo-elements at the end of the selector, focus ring through a custom property…) are documented in
docs/architecture.md
in the repository.