Tailwind Transpiler

raw JSON →
0.0.27 verified Fri May 01 auth: no javascript

A tool (v0.0.27) that parses source files to extract custom Tailwind CSS class names used in HTML/JSX templates and consolidates them into a single JSON file. It relies on AST-based parsing to identify dynamic or custom class combinations that Tailwind's default purge might miss. The project is in early development with no release cadence; its key differentiator is focused extraction of custom classes for Tailwind's safelist, intended for build pipeline integration via npm scripts. Currently limited to default 'src' folder and outputs 'extracted-classes.json'.

error bash: extract-classes: command not found
cause Binary not in PATH because npx not used or package not installed globally.
fix
Use npx extract-classes or add to npm scripts as shown.
error ENOENT: no such file or directory, scan './src'
cause The default 'src' folder does not exist; must specify a valid folder.
fix
Run extract-classes <path-to-existing-folder>
error Cannot find module 'tailwind-transpiler'
cause Package not installed or used in programmatic context incorrectly.
fix
Ensure npm install tailwind-transpiler --save-dev ran and use CLI only, not require().
gotcha CLI name 'extract-classes' may conflict with other packages that expose a binary with same name.
fix Use npx tailwind-transpiler or specify full path in npm scripts.
deprecated No type definitions are exported for programmatic use; only CLI is supported.
fix Use child_process.exec to invoke CLI programmatically.
gotcha Output overwrites 'extracted-classes.json' without prompt, potentially losing previous manual safelist entries.
fix Back up existing file before running extraction.
npm install tailwind-transpiler
yarn add tailwind-transpiler
pnpm add tailwind-transpiler

Install as dev dependency and run the CLI to extract custom Tailwind classes from source code into extracted-classes.json.

npm install tailwind-transpiler --save-dev

// package.json
"scripts": {
  "extract": "extract-classes"
}

npm run extract

// Or with custom folder:
npm run extract -- src/components