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

tw-variables

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tw-variables

400 useful, ready-to-import CSS variables generated straight from Tailwind source files.

  • 3.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

GitHub Workflow Status GitHub Workflow Status

Tailwind Variables (tw-variables)

~400 useful, ready-to-import CSS variables generated straight from Tailwind source files.


Copy / Paste

SourceType
jsDelivrMinified
GitHubUnminified

Browser Import

All variables including colors:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tw-variables/dist/variables.css" />

One or more subsets:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tw-variables/dist/colors.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tw-variables/dist/size.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tw-variables/dist/sky.css" />

Preflight:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tw-variables/dist/preflight.css" />

Package Manager

Installation

pnpm add -D tw-variables

Import - CSS

All variables (including colors):

import 'tw-variables/variables.css'

One or more subsets:

import 'tw-variables/colors.css'
import 'tw-variables/size.css'
import 'tw-variables/green.css'

Preflight:

import 'tw-variables/preflight.css'

Import - PostCSS

If using PostCSS, you can use this package in conjunction with postcss-jit-props to strip any unused variable from the final CSS:

pnpm add -D postcss postcss-jit-props
const postcssJitProps = require('postcss-jit-props')
const twVariables = require('tw-variables')

module.exports = {
   plugins: [postcssJitProps(twVariables)],
}

Usage

.my-container {
   width: var(--width-full);
   max-width: var(--width-xl);
   z-index: var(--z-10);
   padding: var(--size-4);
   margin: var(--size-6);
   font-family: 'Basier Circle', var(--family-sans);
   font-size: var(--text-base);
   font-weight: var(--font-medium);
   line-height: var(--leading-normal);
   letter-spacing: var(--tracking-tight);
   color: var(--blue-500);
   background-color: var(--slate-500);
   border: var(--border-2) solid var(--blue-500);
   border-radius: var(--radius-2xl);
   box-shadow: var(--shadow-lg);
}

Subsets

NamePrefixImportReference
blur--blur-tw-variables/blur.cssLink
borderRadius--radius-tw-variables/border-radius.cssLink
borderWidth--border-tw-variables/border-width.cssLink
boxShadow--shadow-tw-variables/box-shadow.cssLink
colors--blue-, --slate-...tw-variables/colors.cssLink
dropShadow--drop-tw-variables/drop-shadow.cssLink
fontWeight--font-tw-variables/font-weight.cssLink
fontFamily--family-tw-variables/font-family.cssLink
fontSize--text-tw-variables/font-size.cssLink
letterSpacing--tracking-tw-variables/letter-spacing.cssLink
lineHeight--leading-tw-variables/line-height.cssLink
opacity--opacity-tw-variables/opacity.cssLink
maxWidth--width-tw-variables/width.cssLink
screens--screen-tw-variables/screen.cssLink
spacing--size-tw-variables/size.cssLink
transitionTimingFunction--easing-tw-variables/easing.cssLink
zIndex--z-tw-variables/z-index.cssLink

Colors subsets

Colors reference: Link

NamePrefixImport
amber--amber-tw-variables/amber.css
blue--blue-tw-variables/blue.css
cyan--cyan-tw-variables/cyan.css
emerald--emerald-tw-variables/emerald.css
fuchsia--fuchsia-tw-variables/fuchsia.css
gray--gray-tw-variables/gray.css
green--green-tw-variables/green.css
indigo--indigo-tw-variables/indigo.css
lime--lime-tw-variables/lime.css
neutral--neutral-tw-variables/neutral.css
orange--orange-tw-variables/orange.css
pink--pink-tw-variables/pink.css
purple--purple-tw-variables/purple.css
red--red-tw-variables/red.css
rose--rose-tw-variables/rose.css
slate--slate-tw-variables/slate.css
sky--sky-tw-variables/sky.css
teal--teal-tw-variables/teal.css
violet--violet-tw-variables/violet.css
yellow--yellow-tw-variables/yellow.css
zinc--zinc-tw-variables/zinc.css

Updates

Since the output is generated as expected, for now, I consider this package "complete". I also see no point in updating it everytime Tailwind releases a new version.

Once Tailwind will drop some new tokens that are worth to be added, I'll make sure to include them in a new version of this package.


See also

Open Props by Adam Argyle


License

0BSD

Keywords

FAQs

Package last updated on 09 May 2023

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