npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lwc-tailwind

v0.1.0

Published

Salesforce CLI plugin for Tailwind CSS in Lightning Web Components

Downloads

112

Readme

lwc-tailwind

Salesforce CLI plugin that brings Tailwind CSS to Lightning Web Components.

How It Works

LWC uses Shadow DOM, which blocks regular stylesheets. This plugin works around that with a two-layer approach:

  1. Base variables (--tw-* custom properties) are stored in a single static resource and injected into each component's shadow root via loadStyle
  2. Utility classes are split per-component — each LWC gets only the Tailwind rules it actually uses, written into its .css file

The result: full Tailwind CSS support inside Shadow DOM, with SLDS design token integration out of the box.

Install

sf plugins install lwc-tailwind

Quick Start

# Initialize Tailwind in your Salesforce project
sf tailwind init

# Create a component
sf tailwind component myButton

# Start the watcher (rebuilds on file changes)
sf tailwind watch

Commands

sf tailwind init

Sets up Tailwind CSS in your Salesforce project:

  • Installs npm dependencies (tailwindcss, postcss, autoprefixer, cssnano)
  • Creates tailwind.config.js and postcss.config.js with SLDS-aware defaults
  • Creates src/tailwind.css source file
  • Scaffolds runtime LWCs (tailwindElement base class, tailwindUtils with cn() helper)
  • Creates the static resource and metadata

sf tailwind build

Compiles Tailwind CSS and generates per-component CSS files.

sf tailwind build              # Development build
sf tailwind build --production # Minified production build

sf tailwind watch

Watches for file changes and rebuilds automatically. Monitors LWC files (.html, .js, .css), src/tailwind.css, and config files.

sf tailwind watch

sf tailwind component <name>

Scaffolds a new LWC that extends TailwindElement.

sf tailwind component productCard

Usage

Components extend TailwindElement instead of LightningElement:

import TailwindElement from 'c/tailwindElement';

export default class MyButton extends TailwindElement {
}

Use Tailwind classes in templates:

<template>
    <button class="px-4 py-2 bg-brand text-white rounded-md hover:bg-brand-dark">
        Click me
    </button>
</template>

SLDS Design Tokens

The default tailwind.config.js maps SLDS design tokens to Tailwind colors, so they work across Shadow DOM:

| Tailwind Class | SLDS Token | Fallback | |---|---|---| | bg-brand | --lwc-colorBrand | #0176d3 | | text-text-default | --lwc-colorTextDefault | #181818 | | border-border | --lwc-colorBorder | #e5e5e5 | | bg-error | --lwc-colorTextError | #ea001e | | bg-success | --lwc-colorTextSuccess | #2e844a |

cn() Utility

A classnames/clsx-style helper for conditional classes:

import { cn } from 'c/tailwindUtils';

// Conditionals
cn('px-4 py-2', isActive && 'bg-brand', !isActive && 'bg-background-alt')

// Objects
cn('base', { 'bg-brand': isActive, 'opacity-50': isDisabled })

Development Workflow

Run the watcher in one terminal, source tracking in another:

# Terminal 1: Watch and rebuild CSS
sf tailwind watch

# Terminal 2: Deploy changes to org
sf project deploy start --source-dir force-app

License

MIT