css-modules-doctor
v1.2.0
Published
A CLI tool to find unused CSS modules selectors in a project.
Readme
css-modules-doctor
A CLI tool to find unused CSS modules selectors in a project.
Usage
cssmdoc <dir> [options]Options
-i, --ignore <paths...>: Comma-separated paths to ignore. This can be directories or specific CSS files.--styleGlobs <globs...>: Glob patterns to find CSS module files. (default:".css")--exts <exts...>: Component file extensions to check. (default:"jsx","tsx")-r, --reverse: Enable reverse mode to find selectors used in components but not defined in CSS files.-o, --output <path>: Write report output to file instead of stdout.--outputFormat <format>: Output format:cli,json, ormd.- Default:
cli - If omitted and
--outputends with.jsonor.md, format is inferred from extension.
- Default:
Examples
Find unused selectors
To find all unused CSS module selectors in the test_project directory:
cssmdoc ./test_projectFind undefined selectors (Reverse Mode)
To find selectors that are used in your components but don't exist in the corresponding CSS files:
cssmdoc ./test_project -rSave report as JSON
cssmdoc ./test_project --output report.jsonSave report as Markdown
cssmdoc ./test_project --output report.mdForce output format explicitly
cssmdoc ./test_project --output report.txt --outputFormat mdIgnoring files and specifying extensions
To analyze a project with .js files and ignore the dist folder:
cssmdoc ./my-project --exts js --ignore dist