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

vite-plugin-tailwind-autoreference

v0.2.4

Published

Automatically `@reference` your Tailwind CSS file in Svelte, Vue & other SFC files.

Readme

vite-plugin-tailwind-autoreference

Find me on npm!

A Vite plugin which will automatically add @reference directives to your Single File Components (SFCs) <style> blocks.

This plugin is designed to work with Tailwind CSS v4, and is setup to target Svelte and Vue files out of the box.

  • :muscle: Flexible - can target any desired SFC file type!
  • :sunglasses: Easy - just add the plugin to your Vite config!
  • :robot: Automatic - no need to manually add @reference directives!

Compatibility

This plugin targets the following dependency versions:

:exclamation: The compatibility list is not exhaustive, the plugin may work with other Vite/Node versions, but it is not guaranteed.

Installation

To install the plugin, run the following command:

npm

npm install vite-plugin-tailwind-autoreference --save-dev

pnpm

pnpm add vite-plugin-tailwind-autoreference --save-dev

bun

bun add vite-plugin-tailwind-autoreference --dev

Usage

To get started, you need to add the plugin to your Vite config file. Here's a basic example using SvelteKit:

// vite.config.js
import { defineConfig } from 'vite';
import tailwindcss from 'tailwindcss';
import { sveltekit } from '@sveltejs/kit/vite';
import twAutoReference from 'vite-plugin-tailwind-autoreference';

export default defineConfig({
  plugins: [
    sveltekit(),
    twAutoReference({
        cssRoot: 'src/app.css', // Specify the path to the CSS file that imports tailwindcss
        include: [
            // Patterns to include specific file types
        ]
    }),
    tailwindcss(),
  ] // Make sure tailwindcss is added after the autoreference plugin
});

Options

The plugin accepts the following options:

  • cssRoot (required): The path to the CSS file that imports Tailwind CSS. This is used to determine the root of the CSS files in your project.
  • include (optional): A pattern, or an array of patterns, to include specific files. The default targets are Svelte and Vue files.

Using the include option

The include option allows you to specify which files to include in the plugin's processing.

It's recommended to use this syntax to ensure proper processing of your styles. /\.ext\?.*type=style/ where ext is the file extension you want to target. Appending ?type=style ensures that the plugin processes only the style blocks for the specified file type.