New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

tailwindcss-var-generator

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tailwindcss-var-generator

A plugin for Tailwind CSS that generates CSS variables for all of the colors, sizes, and other styles defined in your Tailwind config. This allows you to use the styles from your Tailwind config directly in your CSS code.

latest
Source
npmnpm
Version
0.0.4
Version published
Weekly downloads
7
-91.46%
Maintainers
1
Weekly downloads
 
Created
Source

tailwindcss-var-generator

A plugin for Tailwind CSS that generates CSS variables for all of the colors, sizes, and other styles defined in your Tailwind config. This allows you to use the styles from your Tailwind config directly in your CSS code.

Installation

To install this package, run the following command:

npm install tailwindcss-var-generator

Usage

First, you need to import the tailwindCssVariables function from this package and add it to your Tailwind plugin list:

const plugin = require("tailwindcss/plugin");

const { tailwindCssVariables } = require("tailwindcss-var-generator");

/** @type {import('tailwindcss').Config} */
module.exports = {
  theme: {},
  plugins: [tailwindCssVariables()],
};

The tailwindCssVariables function takes one optional argument, displayKinds, which is an array of styles that you want to generate CSS variables for. By default, it will generate CSS variables for colors and font sizes. You can pass in any combination of the following values to customize which styles to include:

  • "colors": generates CSS variables for all of the colors defined in the Tailwind config.
  • "font-sizes": generates CSS variables for all of the font sizes defined in the Tailwind config.

For example, if you only want to generate CSS variables for colors, you can call the tailwindCssVariables function like this:

tailwindCssVariables(["colors"]);

Once you have added the tailwindCssVariables function to your Tailwind plugin list, you can use the generated CSS variables in your CSS code:

/*
 * This will use the value of the `red.500` color defined in your Tailwind
 * config as the value of the `color` property.
 */
.my-class {
  color: var(--color-red-500);
}

Keywords

tailwindcss

FAQs

Package last updated on 06 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts