Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tailwind-type-generator

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tailwind-type-generator

Generate type definition file of Tailwind CSS classnames.

  • 0.0.14
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

tailwind-type-generator

Simply exports type declaration file of Tailwind CSS classnames.


This library just exports tailwind.d.ts from tailwind.config.js .

It has TailwindClassNames type that lists Tailwind CSS class names.

Install

npm install --save-dev tailwind-type-generator

# peerDependencies
npm install --save tailwindcss

Usage

Example project is ./example.

Fist, export tailwind.d.ts .

npx tailwind-type-generator

Then create utility function and call from components.

lib/tailwind.ts

// lib/tailwind.ts
type TailwindReturnType = "__TAILWIND";
type TailwindParamType = TailwindClassNames | TailwindReturnType;

export const tailwind = (...classNames: TailwindParamType[]) => {
  return classNames.join(" ") as TailwindReturnType;
};
export const tw = tailwind;
// component.tsx
import { tailwind, tw } from "./lib/tailwind";

const textStyle = tailwind("text-white", "text-xl");

export default function () {
  <div classNames={tw("bg-black", "w-full", "h-full", textStyle)} />;
}

Keywords

FAQs

Package last updated on 24 May 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc