bat-css
v1.0.1
Published
A mini Tailwind-like runtime CSS utility library
Downloads
222
Maintainers
Readme
bat-css
A mini Tailwind-like CSS utility library. Use it directly in the browser with zero setup — classes are scanned and styles are injected at runtime, just like Tailwind but without any build step.
Browser (Runtime)
Drop the script into your HTML and start using bat- classes. Styles are applied automatically — no config, no output files.
<script type="module" src="https://unpkg.com/bat-css/browser.js"></script>
<div class="bat-flex bat-bg-blue bat-p-4 bat-text-white bat-rounded-2">
Hello, bat-css!
</div>CLI (Build Time)
Prefer a static CSS file with no runtime JS? Use the CLI to scan your HTML and generate a bat.css file.
# Build once
npx bat-css build
# Custom glob + output path
npx bat-css build "src/**/*.html" -o dist/bat.css
# Watch mode — rebuilds on every save
npx bat-css watch "src/**/*.html"Then link the output in your HTML:
<link rel="stylesheet" href="bat.css" />Available Classes
Colors
bat-bg-{color} — background colorbat-text-{color} — text colorbat-border-{color} — border color
Spacing
bat-p-{size} — paddingbat-px-{size} — padding left & rightbat-py-{size} — padding top & bottombat-m-{size} — marginbat-mx-{size} — margin left & rightbat-my-{size} — margin top & bottombat-w-{size} — widthbat-h-{size} — heightbat-gap-{size} — gapbat-rounded-{size} — border radius
Layout
bat-flex — display: flexbat-grid — display: gridbat-justify-{value} — justify-content (center, between, around, start, end)bat-items-{value} — align-items (center, start, end)
Colors
red blue green yellow black white gray pink purple orange violet cyan
Spacing Scale (0–10)
Each step = 4px. So bat-p-4 = padding: 16px.
| Class | Value |
| ------ | ----- |
| *-0 | 0px |
| *-1 | 4px |
| *-2 | 8px |
| *-3 | 12px |
| *-4 | 16px |
| *-5 | 20px |
| *-6 | 24px |
| *-7 | 28px |
| *-8 | 32px |
| *-9 | 36px |
| *-10 | 40px |
