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 🙏

© 2025 – Pkg Stats / Ryan Hefner

tailwind-apply

v1.0.1

Published

Apply-Your-Own theme system with Tailwind CSS

Downloads

4

Readme

tailwind-apply

tailwind-apply is a simple combination of plugins for TailwindCSS and PostCSS. It is intended to provide a basic mechanism and structure for you to easily "apply-your-own-theme" for TailwindCSS.

It does this by extending TailwindCSS's config the same way as @tailwindcss/typography or @tailwindcss/forms, with one critical difference - you can author custom classes in CSS/SCSS/Sass/Less and even use @apply!

You could always extract classes with @apply but this doesn't integrate directly with the TailwindCSS theme, and you soon run into issues using imports and @layer directives due to the nature of the JIT engine.

This plugin is not intended to replace component partials or use of TailwindCSS classes. The same premature abstraction caveats apply 😎

Getting Started

require the PostCSS plugin and point it to the folder containing your custom styles. This instructs PostCSS to treat the files in the styles folder as dependencies and rebuild your CSS on any changes.

// postcss.config.js

module.exports = {
  plugins: [
    require('tailwind-apply/postcss'), // MUST come before the `tailwindcss` plugin
    require('tailwindcss'),
    require('autoprefixer'),
  ],
}

require the TailwindCSS plugin and point it to the folder containing your custom styles. This instructs TailwindCSS to extends its theme with the files in the styles folder.

// tailwind.config.js

module.exports = {
  content: ['./src/**/*.{js,ts,jsx,tsx}'],
  plugins: [require('tailwind-apply')],
}

Options

styles

Default: ./styles

Set the root folder where your custom styles are located.

pattern

Default: **/*.{css,scss,sass,less}

Set the glob pattern of the files in the styles folder.

Style Structure

Custom styles authored in CSS files must be arranged into sub-folders named after the layer they target:

  • base
  • components
  • utilities

Files outside of these folders won't be added to your TailwindCSS theme, but could be utilised to break down your CSS modules or define CSS variables available across the rest of your theme.

project
├── src
│   ├── components / etc
│   └── index.tsx
├── styles   <-- wherever you save your custom styles and matches the path given to the plugin `styles` option
│   ├── base   <-- classes that get added to Tailwind's `base` layer
│   │   └── headings.css
│   ├── components   <-- classes that get added to Tailwind's `component` layer
│   │   ├── button.css
│   │   ├── input.css
│   │   └── navigation.css
│   └── utilities   <-- added to `utilities` layer
│       └── content.js
├── postcss.config.js
└── tailwind.config.js

TailwindCSS plugins authored in JS can be located anywhere within your project folders since how they get imported into tailwind.config.js is up to you.

Example

// postcss.config.js

module.exports = {
  plugins: [
    require('tailwind-apply/postcss')({
      styles: './src/theme', // Your styles are located in the `src/theme` folder
      pattern: '**/*.sass', // Your styles are authored in Sass only
    }),
  ],
}
// tailwind.config.js

module.exports = {
  plugins: [
    require('tailwind-apply')({
      styles: './src/theme', // Your styles are located in the `src/theme` folder
      pattern: '**/*.sass', // Your styles are authored in Sass only
    }),
  ],
}