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

@ngnomads/tailwind2css

v0.0.4

Published

Tool to Migrate from Tailwind classes to css

Readme

Tailwind2CSS

Tailwind2CSS is a tool that converts Tailwind-like classes used in your project files (HTML, TypeScript, SCSS) into standard CSS rules. This can be useful if you want to migrate away from Tailwind classes to plain CSS, or simply need a static CSS output for your project.

Features

  • Recursive File Scanning: Scans through a specified directory for files with .html, .ts, and .scss extensions.
  • Class Extraction: Extracts unique Tailwind-like classes including those used in @apply directives in SCSS.
  • CSS Generation: Generates corresponding CSS rules based on common Tailwind classes and custom utility classes.
  • Flex Layout Support: Convert flex utilities (flex, flex-row, justify-center, items-center, etc.)
  • Grid Layout Support: Convert grid utilities (grid, grid-cols-, col-span-, row-start-*, etc.)
  • Spacing Utilities: Convert gap, padding, and margin classes
  • Cross-Platform: Works on Mac, Windows, and Linux

Installation

You can use this tool directly with npx:

npx @ngnomads/tailwind2css <targetDirectory> <outputCssFile>

Usage

Basic Usage

# Convert all Tailwind classes in 'src' directory to 'output.css'
npx @ngnomads/tailwind2css src ./output.css

# Convert all classes in 'projects' directory
npx @ngnomads/tailwind2css projects ./styles.css

Example

Input HTML:

<div class="grid grid-cols-3 gap-4">
  <div class="col-span-2 p-4">Item 1</div>
  <div class="flex justify-center items-center p-2">Item 2</div>
</div>

Output CSS:

.grid { display: grid; }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gap-4 { gap: 1rem; }
.col-span-2 { grid-column: span 2 / span 2; }
.p-4 { padding: 1rem; }
.flex { display: flex; }
.justify-center { justify-content: center; }
.items-center { align-items: center; }
.p-2 { padding: 0.5rem; }

Testing

Run the test suite to verify the conversion works correctly:

# Run automated tests (compares expected vs actual output)
npm test

# Generate sample output for manual inspection
npm run test:samples

The test suite:

  • ✅ Converts sample HTML files with flex and grid classes
  • ✅ Compares actual output with expected output
  • ✅ Shows detailed diff if tests fail
  • ✅ Auto-cleans up test files on success

Supported Utilities

Grid Layout

  • grid, grid-cols-*, grid-rows-*
  • col-span-*, col-start-*, col-end-*, col-auto
  • row-span-*, row-start-*, row-end-*, row-auto
  • grid-flow-row, grid-flow-col, grid-flow-dense
  • auto-cols-*, auto-rows-*

Flex Layout

  • flex, flex-row, flex-col, flex-wrap
  • flex-auto, flex-initial, flex-none, flex-1, flex-2
  • justify-*, items-*, self-*

Spacing

  • gap-*, gap-x-*, gap-y-*
  • p-*, px-*, py-*, pt-*, pr-*, pb-*, pl-*
  • m-*, mx-*, my-*, mt-*, mr-*, mb-*, ml-*

Development

# Clone the repository
git clone https://github.com/bharathmuppa/tailwind2css.git

# Install dependencies
npm install

# Run tests
npm test

License

ISC

Author

bharathmuppa