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

@bundler-in-browser/tailwindcss

v0.2.0

Published

tailwindcss plugin for bundler-in-browser

Readme

@bundler-in-browser/tailwindcss

A Tailwind CSS plugin for bundler-in-browser that enables Tailwind CSS processing in the browser environment.

github example

What works:

  • directives (@tailwind, @apply, @layer, @variants, @responsive)
  • configuration (theme, plugins, corePlugins etc.)
  • scss and css-modules
  • third-party plugins (need to be configured, see below)

Installation

npm install bundler-in-browser @bundler-in-browser/tailwindcss

Usage

import { BundlerInBrowser, installSassPlugin } from "bundler-in-browser";
import installTailwindPlugin from "@bundler-in-browser/tailwindcss";

const bundler = new BundlerInBrowser(fs);
await bundler.initialize();

await installSassPlugin(bundler);
await installTailwindPlugin(bundler, {
  rootDir: "/src",
  // pattern: /\.(css|scss|html|vue|jsx?|tsx?|md$/,   // defaults

  // Your tailwind configuration
  tailwindConfig: {
    corePlugins: {
      preflight: false, // Example: disable Tailwind CSS Reset. 👇 see caveats below.
    },
  },
});

And ensure your project contains a /src/main.css like this:

@tailwind base;
@tailwind components;
@tailwind utilities;

And import it in the entry file:

// in /src/index.js

import "./main.css";

Caveats

preflight (CSS Reset)

If you set preflight: false in tailwindConfig, you may need to import CSS Reset manually.

  • suggestion1: use @unocss/reset instead

    // based on Tailwind reset, minus the background color override for buttons
    // to avoid conflicts with UI frameworks.
    import "@unocss/reset/tailwind-compat.css";
  • suggestion2: use tailwind's original preflight

    ⚠️ You need PostCSS + TailwindCSS to process functions like theme('borderColor.DEFAULT', currentColor)

    // as css style (be processed by PostCSS)
    import "@bundler-in-browser/tailwindcss/preflight.css";
    
    // or, as js string (you shall process functions by yourself)
    import { preflight } from "@bundler-in-browser/tailwindcss";

TailwindCSS Plugins

Most tailwind plugins relies on tailwindcss/plugin. You must configure alias for tailwindcss to support.

For vite:

// vite.config.ts
import { defineConfig } from "vite";

export default defineConfig({
  resolve: {
    alias: {
      tailwindcss: "@bundler-in-browser/tailwindcss",

      // or to pick if needed
      // "tailwindcss/plugin": '@bundler-in-browser/tailwindcss/plugin',
      // "tailwindcss/defaultConfig": '@bundler-in-browser/tailwindcss/defaultConfig',
      // "tailwindcss/defaultTheme": '@bundler-in-browser/tailwindcss/defaultTheme',
      // "tailwindcss/colors": '@bundler-in-browser/tailwindcss/colors',
    },
  },
});

For webpack:

// webpack.config.js
module.exports = {
  resolve: {
    alias: {
      tailwindcss: "@bundler-in-browser/tailwindcss",

      // or to pick if needed
      // "tailwindcss/plugin": '@bundler-in-browser/tailwindcss/plugin',
      // "tailwindcss/defaultConfig": '@bundler-in-browser/tailwindcss/defaultConfig',
      // "tailwindcss/defaultTheme": '@bundler-in-browser/tailwindcss/defaultTheme',
      // "tailwindcss/colors": '@bundler-in-browser/tailwindcss/colors',
    },
  },
};

Use tailwind.config.js

For convenience, you can set tailwindConfig: "/tailwind.config.js", but actually it's dangerous because we use eval to load it. And it can't load plugins.

It's recommended to pass an tailwindConfig object directly instead, which supports plugins.

Configuration Options

rootDir

The root directory to scan for files. Defaults to /src.

pattern

The file pattern to scan. Defaults to /\.(css|scss|sass|less|styl|html|vue|jsx?|tsx?|[cm][jt]s)|md$/.

tailwindConfig

The Tailwind CSS configuration object (recommended), or a string path to the configuration file in virtual file system.

Prefer to pass an object directly, which is safe and supports plugins.