Integrate Nuxt with Twind, The smallest, fastest, most feature complete tailwind-in-js solution in existence!
Warning 🧪 This module was a quick prototype to try twind integration with Nuxt and not well tested.
Online playground: stackblitz
Install dependencies:
# npm
npm i -D nuxt-twind twind@next @twind/preset-tailwind@next
# yarn
yarn add -D nuxt-twind twind@next @twind/preset-tailwind@next
# pnpm
pnpm i -D nuxt-twind twind@next @twind/preset-tailwind@next
Add module to nuxt.config.ts
:
import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({
modules: [
'nuxt-twind'
]
})
Create twind.config.ts
in root of your project:
import { defineConfig } from 'twind'
import presetTailwind from '@twind/preset-tailwind'
export default defineConfig({
presets: [presetTailwind()]
})
Now you can use classes in app:
<template>
<div>
<h2 class="inline-block p-3 mb-4 text-2xl font-bold bg-yellow-300">
Hey there!
</h2>
</div>
</template>
npm run dev:prepare
to generate type stubs.npm run dev
to start playground in development mode.MIT. Made with 💚