1.0.2 • Published 3 years ago

tailwindx v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

tailwindx

A little tailwind className helper.

Install

$ npm i tailwindx --save


// or

$ yarn add tailwindx

Create some classNames

import { twx } from "tailwindx";

const classNames = twx("flex", "items-center", "bg-red-500", "text-white");

console.log(classNames);
// "flex items-center bg-red-500 text-white"

Remove duplicated classNames, but leave last one

import { twx } from "tailwindx";

const classNames = twx(
  "flex",
  "items-center",
  "bg-red-500",
  "text-white",
  "bg-red-500"
);

console.log(classNames);
// "flex items-center text-white bg-red-500"

Use a object for toggling classNames

import { twx } from "tailwindx";

const classNames = twx("text-white", {
  "bg-red-500": true, // boolean
});

console.log(classNames);
// "flex items-center bg-red-500 text-white"