Every shortcut. Every keyword. The same language on the playground, the CLI, and your editor — what you see here is what the compiler accepts. 1.2.0
npx with nothing installed..tom file--watch flag, and exit codes.component name: + use name. Reusable blocks with overrides.hover, focus, active, disabled — one indent level.@dark: / @light: included.@import.Once per machine. The tomato command is then available everywhere.
$ npm install -g @srivtx/tomato-css
$ tomato app.tom -o styles.css
Local to one repo. Add a build step to package.json.
$ npm install --save-dev @srivtx/tomato-css
$ npx tomato src/app.tom -o dist/styles.css
{
"scripts": {
"build": "tomato src/app.tom -o dist/styles.css",
"watch": "tomato --watch src/app.tom -o dist/styles.css"
}
}
Try it on a single file without touching node_modules.
$ npx @srivtx/tomato-css app.tom
Create a file called styles.tom:
button:
bg blue-500
color white
pad 2 4
round lg
pointer
smooth
Compile it. Output is plain CSS you can ship to a browser or a CDN.
$ tomato styles.tom -o styles.css
button {
background: #3b82f6;
color: #ffffff;
padding: 0.5rem 1rem;
border-radius: 0.5rem;
cursor: pointer;
transition: all 0.2s ease;
}
$ tomato <input.tom> [-o output.css]
$ tomato --watch <input.tom> [-o output.css]
| Command | What it does |
|---|---|
tomato app.tom |
Compile to app.css |
tomato app.tom -o styles.css |
Custom output path |
tomato --watch app.tom |
Recompile on file change (debounced) |
tomato --version |
Print the version |
1 on a compile error and 0 on success, so it works as a build step in CI. Unknown properties, missing imports, and bad gradient syntax all surface as errors with line numbers.
The compiler is permissive. Elements, classes, IDs, and compound selectors all work.
button:
bg blue-500
nav:
row spread
input:
pad 2 4
.btn-primary:
bg blue-500
color white
.card:
bg white
round xl
shadow lg
#header:
bg slate-900
pad 4 6
#main-content:
pad 8
Names that aren't HTML elements become classes automatically. Use the dot prefix when you want to be explicit.
# these compile to the same rule
card: # → .card { }
.card: # → .card { }
# these stay as element selectors
button: # → button { }
nav: # → nav { }
button, nav, div, header, footer stay as element selectors. Anything else becomes a class.
Define a reusable style block with component name: and pull it into any selector with use name. Properties are expanded inline, so you can override them by adding your own after the use statement.
component btn:
pad 2 4
round lg
bold
pointer
smooth
no border
button:
use btn
bg blue-500
color white
.btn-secondary:
use btn
bg violet-500
Components can use other components, including their nested pseudo states.
component base-input:
pad 3 4
round md
border 1px solid slate-300
smooth
component focus-ring:
use base-input
focus:
ring 2px solid blue-400
border-color blue-500
input:
use focus-ring
w-full
component input-base:
w-full
pad 3 4
round lg
border 1px solid slate-200
bg white
smooth
focus:
border-color blue-500
no outline
textarea:
use input-base
min-height 120px
resize vertical
component container:
max-width 1200px
margin 0 auto
pad 4 6
component stack:
column
gap 4
.page:
use container
use stack
gap 8
use statements. Properties apply in order, so later ones override earlier ones.
Four supported pseudos: hover, focus, active, disabled. Indent one level inside the block.
button:
bg blue-500
color white
smooth
hover:
bg blue-600
shadow lg
focus:
ring 2px solid blue-400
no outline
active:
bg blue-700
disabled:
opacity 0.5
cursor not-allowed
Five breakpoints, plus dark/light mode. Indent one level inside the breakpoint block.
hero:
pad 16
grid 3
gap 6
@mobile:
pad 4
grid 1
@tablet:
grid 2
| Query | Breakpoint |
|---|---|
@mobile: |
max-width: 640px |
@tablet: |
max-width: 768px |
@laptop: |
max-width: 1024px |
@desktop: |
max-width: 1280px |
@wide: |
max-width: 1536px |
@dark: |
prefers-color-scheme: dark |
@light: |
prefers-color-scheme: light |
Define a token once at the top of a file, use it as a value anywhere. Tokens are local to the file.
colors:
primary blue-500
secondary violet-500
dark slate-900
light slate-50
muted slate-400
danger red-500
success green-500
button:
bg primary
color light
.alert-danger:
bg danger
color white
Use @import at the top of a file. The compiler exits 1 if the file is missing.
@import "./tokens.tom"
.button-primary:
bg primary
Every Tailwind color scale, from 50 to 950. Or pass raw CSS colors when you need something off the palette.
# 22 color scales built in
slate, gray, zinc, neutral, stone
red, orange, amber, yellow, lime
green, emerald, teal, cyan, sky
blue, indigo, violet, purple
fuchsia, pink, rose
# usage
bg rose-500
color slate-900
border 1px solid blue-300
# raw CSS colors pass through unchanged
bg #f43f5e
bg rgb(244 63 94 / 0.5)
bg transparent
bg currentColor
The complete shortcut list. Anything Tomato doesn't recognise is passed through unchanged — grid-template-areas, CSS variables, the lot.