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

@0x1js/tailwind-handler

v0.0.2

Published

Lightning-fast Tailwind CSS processor achieving <50ms builds through intelligent caching and incremental processing. Built for Bun 1.2+ with native performance optimizations.

Readme

@0x1js/tailwind-handler

🚀 Intelligent Tailwind CSS Processor - Automatically detects and processes your project's Tailwind CSS through your installed packages.

✨ Features

  • 🔍 Automatic Discovery: Finds your CSS files in standard locations
  • ⚡ Smart Processing: Processes through your installed Tailwind packages
  • 🎯 Version Aware: Supports both Tailwind v3 and v4
  • 🔄 Multi-Strategy: Multiple fallback approaches for reliability
  • 📦 Zero Config: Works out of the box with standard project setups
  • 🌙 Future-Proof: Compatible with current and future Tailwind versions

📦 Installation

bun add @0x1js/tailwind-handler

🚀 Quick Start

import { processTailwindFast } from '@0x1js/tailwind-handler';

// Automatically finds and processes your project's CSS
const result = await processTailwindFast('./my-project', {
  outputPath: 'dist/styles.css',
  config: {
    content: ['src/**/*.{js,ts,jsx,tsx}']
  }
});

console.log(`✅ Generated: ${result.css.length} bytes`);
console.log(`⚡ Processing time: ${result.processingTime}ms`);

🔧 How It Works

1. File Discovery

Automatically scans for CSS files in common locations:

app/globals.css          # Next.js/0x1 style
src/app/globals.css      # Nested structure  
styles/globals.css       # Traditional
css/main.css            # Standard

2. Directive Detection

Recognizes Tailwind directives:

  • @import "tailwindcss" (v4)
  • @tailwind base|components|utilities (v3)
  • @layer and @apply directives

3. Smart Processing

Processes through your installed Tailwind packages via PostCSS

4. Graceful Fallback

Provides essential CSS if processing fails

🎯 Project Setup

Tailwind v4 Projects

# Install dependencies
bun add tailwindcss@^4.0.0 @tailwindcss/postcss postcss

# Create CSS file (app/globals.css)
@import "tailwindcss";

# Create PostCSS config (postcss.config.js)
export default {
  plugins: {
    '@tailwindcss/postcss': {},
    autoprefixer: {},
  },
};

Tailwind v3 Projects

# Install dependencies  
bun add -d tailwindcss@^3.0.0 postcss autoprefixer

# Create CSS file (styles/globals.css)
@tailwind base;
@tailwind components;
@tailwind utilities;

🔍 Advanced Usage

Manual Handler Creation

import { TailwindHandler } from '@0x1js/tailwind-handler';

const handler = new TailwindHandler('./project', {
  content: ['src/**/*.{js,ts,jsx,tsx}'],
  outputPath: 'dist/styles.css'
});

const result = await handler.process();

Debug Mode

// Enable detailed logging
process.env.DEBUG = '@0x1js/tailwind-handler';

// Shows processing steps:
// [TailwindHandler] Found CSS file: app/globals.css (16490 bytes)  
// [TailwindHandler] CSS contains Tailwind directives, processing...
// [TailwindHandler] Processing with Tailwind v4
// [TailwindHandler] PostCSS processing complete: 85342 bytes

🎨 Framework Integration

0x1 Framework

// Automatic integration - no setup required
// Uses 0x1-enhanced CSS processor

Build Scripts

import { processTailwindFast } from '@0x1js/tailwind-handler';

export async function buildCSS() {
  const result = await processTailwindFast(process.cwd(), {
    outputPath: 'dist/styles.css',
    config: { content: ['src/**/*.{js,ts,jsx,tsx}'] }
  });
  
  console.log(`✅ CSS built in ${result.processingTime}ms`);
}

🛠️ Troubleshooting

No CSS generated?

  • Ensure Tailwind packages are installed
  • Check CSS file contains proper directives
  • Enable debug mode for detailed logs

Processing failed?

  • Verify PostCSS config for v4 projects
  • Check content paths in configuration
  • Ensure CSS syntax is valid

Wrong version detected?

  • Check package.json dependencies
  • Ensure consistent Tailwind version usage

📊 API Reference

processTailwindFast(projectPath, options)

Parameters:

  • projectPath: Project root directory
  • options.outputPath: CSS output file path
  • options.config.content: File patterns to scan for classes

Returns:

{
  success: boolean;
  css: string;
  processingTime: number;
  fromCache: boolean;
}

TailwindHandler Class

// Constructor
new TailwindHandler(projectPath: string, config: TailwindConfig)

// Main method
async process(): Promise<{
  css: string;
  fromCache: boolean;
  processingTime: number;
}>

// Configuration
interface TailwindConfig {
  content: string[];
  outputPath?: string;
}

🌟 Best Practices

  1. Standard Locations: Place CSS in app/globals.css or styles/globals.css
  2. Proper Dependencies: Install Tailwind packages in your project
  3. Accurate Content: Specify correct file patterns for optimal output
  4. PostCSS Config: Include for v4 projects
  5. Debug Logging: Use when troubleshooting issues

📝 License

MIT © 0x1 Framework


Reliable Tailwind CSS processing for modern web projects