
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
This is an experimental SWC transpiler to bring compile time
tailwind macros to SWC (and nextjs) a-la twin macro. The goal
is to give the same great compile-time ergonomics and flexibility
while performing considerably better than babel-based alternatives.
Supports both emotion
and styled-components
for CSS-in-JS, and
many build systems such as SWC, nextjs, Vite, etc.
We are currently testing against the following versions. Other versions outside these may still work, however.
stailwc | NextJS | Emotion | Styled Components | swc | Vite |
---|---|---|---|---|---|
latest | 13.4.3 | 11.10.5 | 5.3.6 | 1.3.24 | 4.1.0 |
Feature | Emotion | Styled Components |
---|---|---|
tw jsx attribute | ✅ | ✅ |
tw template tag | ✅ | ✅ |
tw component syntax | ✅ | ✅ |
tw component extension syntax | ✅ | ✅ |
Global styles | ✅ | ✅ |
Plugin parameter suggestions | ✅ | ✅ |
> npm add -D stailwc
> yarn add -D stailwc
> pnpm add -D stailwc
To get started with NextJS, place the following in your next.config.js. For other framworks / tools, please see the examples.
next.config.js
const stailwc = require("stailwc/install");
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
experimental: {
swcPlugins: [
stailwc({
engine: "emotion", // or "styled-components"
}),
],
},
compiler: {
emotion: true,
// or
styledComponents: true,
},
};
module.exports = nextConfig;
Optionally, you can also include the tailwind normalizer + forms
plugin by including the <TailwindStyle />
component. Please see
the relevant examples.
_document.tsx
import { TailwindStyle } from "stailwc";
export default function App({ Component, pageProps }) {
return (
<>
<TailwindStyle />
<Component {...pageProps} />
</>
);
}
There is one step you need to take to get types working. You need to add stailwc.d.ts
to the root of your source
folder.
tw
tagYou can interact with stailwc in two ways. The first is through
the tw
JSW attribute, and the second is via the tw
template
tag.
import { useState } from "react";
export const ColorButton = () => {
const [clicked, setClicked] = useState(0);
return (
<button
tw="p-1 m-4 text-green bg-white hover:(bg-gray text-yellow md:text-red) border-3"
css={clicked % 2 == 0 ? tw`border-green` : tw`border-blue`}
onClick={() => setClicked(clicked + 1)}
>
Clicked {clicked} times
</button>
);
};
You can also create styled components using the tw
template tag.
This will automatically create the correct syntax for both emotion
and styled-components
.
export const StyledButton = tw.button`p-1 m-4 text-green bg-white hover:(bg-gray text-yellow md:text-red) border-3`;
export const ShadowButton = tw(StyledButton)`shadow-lg`;
There are examples available for both emotion
and styled-components
.
You can run them by cloning the repo and running yarn
followed by
yarn dev
in the example directory. You will need to stailwc
first.
FAQs
An experimental transpiler to bring tailwind macros to SWC rocket
The npm package stailwc receives a total of 21 weekly downloads. As such, stailwc popularity was classified as not popular.
We found that stailwc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.