Everything the CLI does, you can do from JavaScript. The core is dependency-free and runs in Node and the browser.
CSSGenerator#
example.mjs
import { CSSGenerator } from '@nakshora/core';
const gen = new CSSGenerator({
content: ['./src/**/*.html'],
theme: { extend: { colors: { brand: { 500: '#6d28d9' } } } },
});
const css = gen.generate(); // JIT — only used classes
const full = gen.generate({ mode: 'full' }); // everythingKey methods#
| Method | Returns |
|---|---|
generate(options) | Compiled CSS string (JIT when content is set) |
getStats() | Catalog statistics: utilities, categories, palettes |
getUtilities() | The utility registry (class → CSS) |
generateFromContent(html) | Compile ad-hoc markup without touching disk |
getVariables() | The :root CSS custom properties |
getKeyframes() | All animation keyframes |
