npm.io
3.1.0 • Published 2 weeks ago

@nakshora/core

Licence
MIT
Version
3.1.0
Deps
0
Size
14.0 MB
Vulns
0
Weekly
0

@nakshora/core

The Nakshora JIT CSS compiler & engine — 11,417 utilities across 35 categories, state + responsive variants, themes, design components and a plugin API. Zero runtime JavaScript, zero dependencies.

npm version license node

Nakshora is a utility-first CSS framework with a Tailwind-compatible class grammar. @nakshora/core is the compiler everything else is built on — the CLI, the PostCSS plugin and the Vite plugin are thin wrappers around it.

Install

npm install @nakshora/core

Dual ESM/CJS builds with TypeScript declarations.

Usage

JIT — compile only the classes you use
import { CSSGenerator } from '@nakshora/core';

const generator = new CSSGenerator({
  content: ['./src/**/*.{html,js,ts,jsx,tsx,vue}'],
});

const css = generator.generate({ minify: true });
Full build — every utility
import { createGenerator } from '@nakshora/core';

const css = createGenerator().generate({ mode: 'full' });
Compile a raw string of markup
import { CSSGenerator } from '@nakshora/core';

const css = new CSSGenerator().generateFromContent(
  '<button class="px-5 py-2.5 bg-blue-500 hover:bg-blue-600 md:hover:bg-blue-700">Go</button>',
);
Themes & presets
import { CSSGenerator, neonTheme, applyPreset, defaultTheme, mergeConfig } from '@nakshora/core';

const config = mergeConfig(defaultTheme, { theme: neonTheme });
const css = new CSSGenerator(config).generate();

Five presets ship with the package: neonTheme, pastelTheme, brutalistTheme, minimalistTheme, natureTheme.

Layer-by-layer output
const g = new CSSGenerator(config);
g.getBase(); //         preflight / resets
g.getVariables(); //    :root CSS custom properties for every token
g.getKeyframes(); //    @keyframes
g.getUtilitiesFull(); // all utilities (+ variants)
g.getComponents(); //   glass / neon / brutalist / minimalist / skeletons
AI / tooling assets
import { buildUtilityList, buildAICorpus, corpusToSFT, metadata, version } from '@nakshora/core';

buildUtilityList(); // every utility, grouped by category
buildAICorpus(); //    structured corpus (JSON) for LLM training
corpusToSFT(); //      instruction-tuning dataset (JSONL)

Configuration

new CSSGenerator({
  content: ['./src/**/*.{html,js,ts,jsx,tsx}'], // enables JIT
  safelist: ['lg:flex', 'dark:bg-slate-900'], // always emit these
  important: true, // or '#app' to scope specificity
  darkMode: 'class', // `dark:` variants via <html class="dark">
  theme: {
    colors: { brand: { DEFAULT: '#6d28d9', 500: '#8b5cf6' } },
    spacing: { 18: '4.5rem' },
    screens: { '3xl': '1920px' },
  },
  corePlugins: { preflight: true, container: false },
  plugins: [
    {
      name: 'my-plugin',
      utilities: { 'btn-xl': { padding: '1rem 2rem' } },
    },
  ],
});

Variants compose in any order — md:hover:bg-blue-600, dark:focus-visible:ring-2, group-hover:text-white, peer-checked:border-green-500.

Documentation

License

MIT Rizwan Rahim Chowdhury — nakshora/nakshora

Keywords