GithubHelp home page GithubHelp logo

pi0 / nuxt-twind Goto Github PK

View Code? Open in Web Editor NEW
42.0 4.0 0.0 111 KB

⚡️ Integrate Nuxt with Twind, The smallest, fastest, most feature complete tailwind-in-js solution in existence!

Home Page: https://stackblitz.com/fork/github/pi0/nuxt-twind/tree/main/playground

Vue 22.48% TypeScript 77.52%

nuxt-twind's Introduction

Nuxt Twind Module

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

Features

  • ⚡️ No build step: Get all the benefits of Tailwind without the need for PostCSS, configuration, purging, or autoprefixing.
  • 🚀 SSR Transforms: Fast class transformation and Optimizations
  • 😎 One low fixed cost: Twind ships the compiler, not the CSS. This means unlimited styles and variants for one low fixed cost of ~4.5kB.
  • 🚗 Client HMR support: Fast reloads on client-side

Installation

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>

Development

  • Run npm run dev:prepare to generate type stubs.
  • Use npm run dev to start playground in development mode.

License

MIT. Made with 💚

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.