An experimental SWC transpiler that brings compile-time Tailwind macros to SWC and Next.js, similar to twin.macro but with better performance via SWC instead of Babel. Current stable version is 0.17.0, actively developed with a focus on Next.js compatibility (tested with v13.4.3). Supports both emotion and styled-components as CSS-in-JS engines, with features like the tw JSX attribute, tw template tag, component syntax, and global styles. Key differentiator: 10-100x faster compilation compared to Babel-based alternatives due to SWC's Rust-based implementation.
npm install stailwcNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates Next.js configuration with stailwc SWC plugin, TailwindStyle component for base styles, and tw usage via JSX attribute and template tag.
Upgrade to stailwc 0.17.0 or later and use SWC 1.3.24+
Add `import { tw } from 'stailwc'` in any file using the template tag.Use `const stailwc = require('stailwc/install')` instead of ESM import.Set `compiler.emotion: true` for emotion or `compiler.styledComponents: true` for styled-components in next.config.js.
Ensure `stailwc` is installed (e.g., `npm install -D stailwc`) and use `require('stailwc/install')` in next.config.js.Ensure stailwc/install is only required in next.config.js (Node.js context), not in client-side code.
Call `stailwc({ engine: 'emotion' })` directly in the swcPlugins array, not as a reference.