tailwindcss-vue
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Version Downloads License CircleCI Build Status Language grade: JavaScript standard code style

The package it easy to use Tailwind CSS with Vue.

Without this package:

<div class="bg-red-500 hover:bg-purple hover:text-white sm:bg-green-500 md:bg-blue-500 md:w-3/4 lg:bg-pink-500 lg:w-2/4 xl:bg-teal-500 xl:w-1/4">
  Text
</div>

With this package:

<div
  :class="$tailwind({
    default: 'bg-red-500',
    hover: 'bg-purple text-white',
    sm: 'bg-green-500',
    md: 'bg-blue-500 w-3/4',
    lg: 'bg-pink-500 w-2/4',
    xl: 'bg-teal-500 w-1/4'
  })"
>
  Text
</div>

Installation

yarn add tailwindcss-vue
# Or 
npm install tailwindcss-vue

Get started

  1. Add Vue.use for the plugin.
import { TailwindCssVue } from 'tailwindcss-vue'
 
Vue.use(TailwindCssVue)
  1. Use in your components. Here is a complete example:
<template>
  <div>
    <div class="bg-red-500 hover:bg-purple hover:text-white sm:bg-green-500 md:bg-blue-500 md:w-3/4 lg:bg-pink-500 lg:w-2/4 xl:bg-teal-500 xl:w-1/4">
      Text
    </div>
  
    <div
      :class="$tailwind({
        default: 'bg-red-500',
        hover: 'bg-purple text-white',
        sm: 'bg-green-500',
        md: 'bg-blue-500 w-3/4',
        lg: 'bg-pink-500 w-2/4',
        xl: 'bg-teal-500 w-1/4'
      })"
    >
      Text
    </div>
  </div>
</template>

There is another use case with the script tag (CDN version of package):

<script src="https://unpkg.com/tailwindcss-vue"></script>

Or

<script src="https://cdn.jsdelivr.net/npm/tailwindcss-vue"></script>

Write your suggestions for improvement, I will be glad to read!

Package Sidebar

Install

npm i tailwindcss-vue

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

20.1 kB

Total Files

28

Last publish

Collaborators

  • ilyazelenko