Style with
intention.
A lightweight utility-first CSS framework powered by JavaScript — drop in one script tag and start styling instantly.
CDN — paste into any HTML file
<script src="https://cdn.jsdelivr.net/npm/rochakcss/dist/rochak.js"></script>
OR — install via npm
npm install rochakcss
Two ways to
get started
Use the CDN for instant setup with no tooling, or install via npm for bundler-based projects.
How it works
Four focused modules. Zero dependencies. Pure JavaScript DOM manipulation.
Config
Lookup tables for static classes, spacing prefixes, sizing prefixes, and value maps.
config.jsParser
Pure function that takes one class name string and returns a CSS style object or null.
parser.jsApplier
Walks the DOM, calls the parser, and assigns inline styles via Object.assign().
applier.jsObserver
MutationObserver auto-applies styles to new or changed elements — no manual refresh needed.
index.jsZero to styled
in 60 seconds
No build tools. No config files. Add the CDN script tag and write r-* classes.
<!-- 1. Add CDN script tag --> <script src="https://cdn.jsdelivr.net/npm/rochakcss/dist/rochak.js"></script> <!-- 2. Use r-* classes freely --> <div class="r-flex r-items-center r-gap-4 r-p-6 r-bg-#1e293b r-rounded-3"> <p class="r-text-18 r-weight-bold r-color-#f5c542"> Hello, rochakcss! </p> </div> <!-- 3. Done. rochakcss auto-applies all r-* styles. -->
Numeric Scale
Most numeric values multiply by 4 to produce pixels.
See it in action
Real r-* classes rendering in this very page.
<div class="r-flex r-dir-col r-gap-3 r-p-6 r-bg-#1a1a2e r-rounded-3 r-border-1"> <span class="r-text-11 r-weight-semibold r-color-#f5c542 r-uppercase r-spacing-2">New Release</span> <h2 class="r-text-24 r-weight-bold r-color-#fff">rochakcss v1.0</h2> <p class="r-text-13 r-color-#8892a4 r-leading-6">Style your HTML with utility classes...</p> <button class="r-bg-#f5c542 r-text-12 r-weight-bold r-rounded-1 r-px-4 r-py-2 r-pointer">Install Now</button> </div>
Live Playground
Edit HTML with r-* classes and see a live rendered preview instantly — powered by the CDN. No local files needed.
Class reference
Every utility grouped by category. Hover to explore.
Programmatic control
Three methods exposed on the global rochak
object.
rochak.refresh()
Re-scans the entire DOM and re-applies all r-* classes. Call after large dynamic renders.
rochak.refresh();
rochak.parse(className)
Returns the CSS style object for a single class name, or null if unrecognised.
rochak.parse("r-p-4")
// → { padding: "16px" }
rochak.getConfig()
Returns all configuration tables — useful for editor plugins or documentation generators.
rochak.getConfig()
// → { staticStyles,
// spacing, sizing }