Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Next.js 13 starter with Emotion, Tailwind CSS via twin.macro, TypeScript, and SWC compiler support.
Next Emotion Twin Typescript is a Next.js boilerplate that combines Emotion, Tailwind CSS, twin.macro, and TypeScript while preserving the SWC compiler, created by Dan (geonhwiii) for developers who want utility-first styling without losing build performance.
Next Emotion Twin Typescript is a Next.js starter template that integrates Emotion for CSS-in-JS styling, Tailwind CSS utility classes through twin.macro, and TypeScript all in one pre-configured repository. It takes a blank Next.js scaffold and outputs a clean project structure with path aliases, reusable folders, and deployment hooks. The template targets Next.js v13.1.1, React v18.2.0, Tailwind CSS v3.2.4, and TypeScript v4.9.4, as shown by the badges in the README.
The core motivation is to let twin.macro work with the SWC compiler. Twin.macro normally forces a custom Babel setup which disables SWC; this project's withTwin.js file modifies the Next.js configuration so the SWC compiler stays active while twin.macro still processes Tailwind utilities.
npx degit geonhwiii/next-emotion-twin-typescript, npx create-next-app -e, or yarn create next-app.<div css={tw`flex flex-col justify-center items-center`}>
<div css={tw`text-center font-bold`}>Hello World!!!</div>
</div>Next Emotion Twin Typescript is for Next.js developers who prefer Tailwind's utility classes but also want the flexibility of Emotion's CSS-in-JS. It is also for development teams that need a standardized starting point with consistent folder organization and TypeScript from the beginning. Finally, it helps developers who want to avoid the custom Babel configuration that twin.macro would otherwise require.
npx create-next-app -e https://github.com/geonhwiii/next-emotion-twin-typescript and run yarn install to get a styled, typed application foundation.tw directive inside Emotion's css prop, reducing context switching between stylesheets.After cloning the repository via degit or create-next-app, you install dependencies with yarn or npm install. The starter's withTwin.js file plugs twin.macro into Next.js's webpack configuration, enabling emotion and Tailwind processing through SWC. Then you can immediately start building components using the css prop and twin.macro's tw template literal.
Yes. The supplied withTwin.js configuration integrates twin.macro into Next.js without requiring a custom Babel setup, which preserves the SWC compiler for faster builds and loads.
The tsconfig.json already maps "@/" to several directories such as "@/components", "@/utils", "@/styles", and "@/configs". You can still customize the paths by editing the "paths" object in tsconfig.json.
Twin.macro lets you use Tailwind utility classes inside Emotion's css prop, giving you the convenience of utility-first styling with the power of CSS-in-JS, all without a runtime layer beyond Emotion.
