fast-tcm
v0.4.1
Published
Go rewrite of typed-css-modules
Maintainers
Readme
fast-tcm
A high-performance CSS Modules type definition generator written in Go. Generates .d.ts files for .css and .pcss (PostCSS) files with support for @keyframes, @value, :export, and composes. Additionally, it offers options for export formats, camelCase conversion, and custom glob patterns.
Installation
npm install -D fast-tcmNo Go installation required—the package includes prebuilt binaries for macOS (Intel/Apple Silicon), Linux (x86/ARM), and Windows (x86).
Usage
npx ftcm srcThis generates .d.ts files alongside .css and .pcss files in src and subdirectories.
Flags can be placed before or after positional arguments, so the following are equivalent:
npx ftcm -w src
npx ftcm src -wYou can also pass the output directory as an optional second positional argument:
npx ftcm generated src
# equivalent to
npx ftcm -o generated srcSupported Files
.css(standard CSS).pcss(PostCSS)- Other formats may be supported, use with caution and consider
--allowArbitraryExtensions.
Options
--exportType <type>— Export format:commonjs,default, ornamed(default:default)--camelCase— Convert kebab-case to camelCase in generated types--dropExtension— Remove file extension from generated.d.tsnames--allowArbitraryExtensions— Allow non-standard CSS extensions (e.g.,.module.css)--outDir <dir>— Write.d.tsfiles to a different directory--pattern <glob>— Custom glob pattern to match files (default:**/*.{css,pcss})--listDifferent— List files with out-of-date or missing.d.ts(exit code 1 if any found)--silent— Suppress all output (implies--listDifferent)--watch/-w— Watch for file changes and regenerate.d.tsfiles--version— Show version information--help— Show usage information
Example
# Generate with camelCase and named exports
npx ftcm --exportType named --camelCase srcLicense
MIT
