Integration for Vue CLI

Features

  • ⚡️ It's FAST - 20~100x times faster than vue-cli-plugin-tailwind
  • 🧩 On-demand CSS utilities (Compatible with Tailwind CSS v2) and native elements style resetting
  • 🍃 Load configurations from tailwind.config.js
  • 📄 CSS @apply / @screen directives transforms
  • 🎳 Support Utility Groups - e.g. bg-gray-200 hover:(bg-gray-100 text-red-300)

Setup

Install using Vue CLI. (Vue CLI 4+ is recommended)

vue add windicss

⚠️ This module is a pre-release, please report any issues you find.

Configuration

You can change the behaviour of the plugin by modifying the options in ./vue.config.js.

vue.config.js
module.exports = {
  pluginOptions: {
    windicss: {
      // see https://github.com/windicss/vite-plugin-windicss/blob/main/packages/plugin-utils/src/options.ts
    },
  },
}

If you have a tailwind.config.js, please rename it to windi.config.js or windi.config.ts.

See here for configuration details.

Migrating

If you were previously using vue-cli-plugin-tailwind, please consult the documentation on migrating.

yarn remove vue-cli-plugin-tailwind

Options

  • Default:
export default {
  scan: {
    dirs: ['src'],
    exclude: [
      'node_modules',
      '.git',
      'public/**/*',
      '*.template.html',
      'index.html',
    ],
    include: [],
  },
  transformCSS: 'pre',
}

Examples

Disable Preflight

ngridsome.config.js

module.exports = {
  // ...
  pluginOptions: {
    windicss: {
      preflight: false,
    },
  },
}

Caveats

Scoped Style

@media directive with scoped style can only work with css postcss scss but not sass, less nor stylus