neuron-explorer
Steering-first neuron explorer for Qwen3.5-4B: push every MLP neuron, keep every rollout, browse the results
翻译准备中
just in time css utilities engine
翻译准备中
取自仓库 README
正在加载完整 README。
查看完整 README ↗Instant CSS - AI-powered CSS utilities with baroque elegance
BaroCSS generates utility CSS in the browser or on a server. It has a CSS engine, a browser runtime, and a server runtime. See the Tailwind compatibility report for measured coverage.
Tailwind only styles the classes it sees at build time. BaroCSS styles the ones that arrive later, from AI models, CMS content, or widgets in a shadow root, alongside your Tailwind build.
@barocss/server (#266)Don't use it when your class set is known in advance (let Tailwind generate it at build time, #218), or for a
no-build page where the official @tailwindcss/browser already works (#198).
Visit our comprehensive documentation site: BaroCSS Documentation
The documentation includes:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>BaroCSS App</title>
<script type="module">
import { baroStart } from 'https://cdn.jsdelivr.net/npm/@barocss/browser/dist/cdn/barocss.js';
baroStart();
</script>
</head>
<body>
<div class="bg-gradient-to-r from-blue-500 to-purple-600 text-white p-8 rounded-xl shadow-2xl">
<h1 class="text-4xl font-bold mb-6">Hello BaroCSS!</h1>
<p class="text-xl opacity-90">Instant styling without build</p>
<button class="mt-6 bg-white text-blue-600 px-6 py-3 rounded-lg hover:bg-gray-100 transition-all duration-300 transform hover:scale-105">
Get Started
</button>
</div>
</body>
</html>
Choose the package for your environment:
| Package | Use |
|---|---|
@barocss/kit | Parse classes and generate CSS |
@barocss/browser | Watch DOM changes and insert CSS |
@barocss/server | Generate CSS in Node.js |
The browser and server packages depend on @barocss/kit. Install the runtime you use:
# Using pnpm (recommended)
pnpm add @barocss/browser
# Using npm
npm install @barocss/browser
# Using yarn
yarn add @barocss/browser
For server code, install @barocss/server. For direct engine use, install @barocss/kit.
import { BrowserRuntime } from '@barocss/browser';
// Initialize runtime
const runtime = new BrowserRuntime();
// Watch DOM changes and auto-style
runtime.observe(document.body, { scan: true });
BaroCSS works like Tailwind CSS's JIT mode but processes everything in real-time:
// Just add classes - BaroCSS handles the rest
document.body.innerHTML = `
<div class="bg-gradient-to-r from-blue-500 to-purple-600 text-white p-8 rounded-xl">
<h1 class="text-4xl font-bold mb-6">Real-time Styling</h1>
<p class="text-xl opacity-90">This gets styled instantly!</p>
</div>
`;
// BaroCSS automatically:
// ✅ Detects new classes
// ✅ Generates CSS
// ✅ Applies styles
// ✅ No build step needed
import { BrowserRuntime } from '@barocss/browser';
const runtime = new BrowserRuntime();
// Add classes dynamically
runtime.addClass('bg-red-500 text-white p-4 rounded-lg shadow-md');
// Classes work immediately
document.body.innerHTML = `
<div class="bg-red-500 text-white p-4 rounded-lg shadow-md">
Styled instantly!
</div>
`;
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<div class="bg-white p-6 rounded-lg shadow-md hover:shadow-lg transition-shadow">
<h3 class="text-lg font-semibold mb-2">Card 1</h3>
<p class="text-gray-600">Responsive grid with hover effects</p>
</div>
<!-- More cards... -->
</div>
<button class="bg-blue-500 hover:bg-blue-600 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 text-white font-medium py-2 px-4 rounded transition-colors">
Interactive Button
</button>
<div class="bg-white dark:bg-gray-900 text-gray-900 dark:text-white p-6 rounded-lg">
<h2 class="text-xl font-semibold">Dark Mode Support</h2>
<p>Automatically adapts to system preferences</p>
</div>
<div class="w-[calc(100%-2rem)] bg-[#ff6b6b] text-[rgb(255,255,255)] p-4">
Custom values with arbitrary value syntax
</div>
const runtime = new BrowserRuntime({
config: {
theme: {
extend: {
colors: {
'brand': {
50: '#f0f9ff',
500: '#0ea5e9',
900: '#0c4a6e',
}
},
spacing: {
'18': '4.5rem',
'88': '22rem',
}
}
}
}
});
const runtime = new BrowserRuntime({
config: {
darkMode: 'class', // or 'media'
theme: {
extend: {
colors: {
gray: {
900: '#111827',
800: '#1f2937',
}
}
}
}
}
});
import { BrowserRuntime } from '@barocss/browser';
const runtime = new BrowserRuntime();
runtime.observe(document.body, { scan: true });
import { ServerRuntime } from '@barocss/server';
const serverRuntime = new ServerRuntime();
const css = serverRuntime.generateCss('bg-blue-500 text-white p-4');
To inline server CSS in HTML so the browser runtime adopts it, wrap it with ssrStyleTag (pass { nonce } under a strict CSP):
import { ssrStyleTag } from '@barocss/server';
const head = ssrStyleTag(css); // <style data-barocss-ssr>…</style>
import { parseClassToAst, generateCss, createContext } from '@barocss/kit';
const ctx = createContext({
theme: {
colors: { red: { 500: '#ef4444' } },
spacing: { 4: '1rem' }
}
});
const css = generateCss('bg-red-500 text-white p-4', ctx);
BaroCSS supports the utility groups below. See the compatibility report for the tested Tailwind version, cases, and results.
container, columns, break-after, break-beforeblock, inline-block, inline, flex, inline-flexgrid, inline-grid, contents, hiddenflex, grid, order, gapjustify-start, justify-center, justify-enditems-start, items-center, items-endp-4, m-2, space-x-4, space-y-2px-6, py-3, pt-2, pb-4w-full, h-screen, min-h-screen, max-w-mdw-1/2, h-16, min-w-0, max-h-96text-sm, font-bold, leading-relaxedtext-center, text-left, text-rightuppercase, lowercase, capitalizebg-blue-500, bg-gradient-to-r, bg-[url(...)]bg-opacity-50, bg-blend-multiplyborder-2, rounded-lg, border-blue-500border-opacity-25, border-dashedshadow-lg, opacity-50, blur-smbackdrop-blur, backdrop-filtertransition-all, duration-300, ease-in-outrotate-45, scale-110, translate-x-4hover:bg-blue-600, focus:ring-2, active:scale-95group, peer, group-hover:, peer-focus:Extend BaroCSS with custom utilities using the global registry functions:
import { staticUtility, functionalUtility } from '@barocss/kit';
// Register static utilities
staticUtility('custom-bg', [
['background-color', 'var(--custom-color)'],
['border-radius', '8px']
]);
// Register functional utilities
functionalUtility({
name: 'custom-text',
prop: 'color',
handle: (value) => [decl('color', value)]
});
barocss/
├── apps/
│ └── barocss-docs/ # Documentation site
├── packages/
│ ├── barocss/ # @barocss/kit CSS engine
│ ├── barocss-browser/ # @barocss/browser DOM runtime
│ └── barocss-server/ # @barocss/server Node runtime
└── docs/ # Project documentation
# Clone the repository
git clone https://github.com/barocss/barocss.git
cd barocss
# Install dependencies
pnpm install
# Run tests
pnpm test
# Start development servers
pnpm dev
The documentation site is built with VitePress and deployed to GitHub Pages:
# Navigate to docs directory
cd apps/barocss-docs
# Start development server
pnpm docs:dev
# Build for production
pnpm docs:build
For detailed documentation, visit our documentation site or check the local docs:
We welcome contributions! Please see our Contributing Guide for details.
This project is licensed under the MIT License - see the LICENSE file for details.
BaroCSS - Where Tailwind meets realtime. Style anything, anywhere, instantly.
No build step. No waiting. Just pure, instant CSS magic. ✨