ben-rogerson/twin.macro

🦹‍♂️ Twin blends the magic of Tailwind with the flexibility of css-in-js (emotion, styled-components, solid-styled-components, stitches and goober) at...

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 33 minutes ago
Added to GitGenius on July 31st, 2026
Created on February 19th, 2020
Open Issues & Pull Requests: 19 (+0)
GitHub issues: Enabled
Number of forks: 179
Total Stargazers: 8,028 (+0)
Total Subscribers: 29 (+0)

Issue Activity (beta)

Open issues: 5
New in 7 days: 1
Closed in 7 days: 0
Avg open age: 636 days
Stale 30+ days: 4
Stale 90+ days: 4

Recent activity

Opened in 7 days: 1
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 3

Top labels

  • bug (1)
  • feature request (1)
  • stitches (1)

Most active issues this week

Repository Insights (GitGenius)

Median issue/PR response: 6.5 hours
Mean response time: 66.2 days
90th percentile: 37.5 days
Tracked items: 10

Most active contributors

Detailed Description

Twin.macro is a Babel macro that integrates Tailwind CSS with CSS-in-JS libraries at build time, supporting emotion, styled-components, solid-styled-components, stitches, and goober. The project enables developers to write Tailwind utility classes within JavaScript and TypeScript files, which are then compiled into CSS objects during the build process, eliminating runtime overhead and bundle size penalties.

The core functionality allows developers to use Tailwind classes through a tw import that can be nested within css props for conditional styling or used to create and style components with styled-components. The macro supports mixing Sass styles with Tailwind classes and provides variant groups to apply variants across multiple classes simultaneously. Twin includes helpful error messages with suggestions for mistyped class names and variant values drawn from the Tailwind configuration, and it integrates with the official Tailwind VSCode plugin to enable autocomplete suggestions directly from the Tailwind config.

Key features include simplified imports that collapse multiple styling library imports into a single import statement, zero runtime bundle size impact since all conversions happen at compile time via Babel, the ability to add !important to classes using trailing or leading bang syntax, and access to theme values from the Tailwind configuration through a dedicated theme import. The project works across numerous modern development stacks and build tools, with documented examples for Parcel, Webpack, Preact, Create React App, and Vite, as well as advanced frameworks like Next.js, Blitz.js, Gatsby, and T3 App. Component library support includes examples for Storybook, yarn and npm workspaces, Rollup, and HeadlessUI.

According to GitGenius activity tracking, the repository shows a median issue and pull request response latency of 12.9 hours across nine tracked items, indicating active maintenance. The primary contributor is ben-rogerson with 30 tracked events, followed by ethanve with 4 events and LouisJackson with 3 events. The most active issue labels tracked include bug, feature request, and stitches-specific discussions. The repository maintains connections with other significant projects through overlapping contributors, including sveltejs/svelte, microsoft/vscode, and jaredpalmer/razzle.

The project provides comprehensive documentation including prop styling and styled component guides, configuration options, and an optional babel-plugin-twin for using tw and css props without explicit imports. Additional resources cover advanced theming with CSS variables, React breakpoint syncing with Tailwind, VSCode snippets for faster development, and community discussions about VSCode plugin compatibility. Twin originated from earlier work on babel-plugin-tailwind-components and maintains an active Discord community for announcements and styling discussions.

twin.macro
by
ben-rogersonben-rogerson/twin.macro

Repository Details

Fetching additional details & charts...