CleanerCSS helps you safely detect and remove unused selectors from CSS and SCSS files without breaking your app. It uses workspace-wide usage scanning, conservative heuristics for frameworks and dynamic classes, and always shows a native VS Code diff preview before writing changes.
Key points:
Conservative by design: uncertain or dynamic selectors are preserved by default.
Native VS Code diff preview and WorkspaceEdit application - you always review before changes.
Local snapshots and history for safe rollback.
Configurable safelists, framework hints and scanning options.
Visual Editor & Revert your changes
Quick start
Open any .css or .scss file in your workspace.
Run the command CleanerCSS: Clean Current File from the Command Palette.
Review the native VS Code diff. Apply to write changes (a snapshot is taken automatically) or export a patch.
Features
Workspace scanning for selector usage (includes JS/TS/HTML and simple template strings).
Conservative SCSS support via postcss-scss with safeguards for complex constructs.
cleanerCSS.minConfidenceToRemove - confidence threshold before proposing removals.
cleanerCSS.analysisOutput - where analysis results appear (problems, markdownReport, ask).
See package.json for the full configuration schema.
Privacy and safety
CleanerCSS runs locally. It does not send your code to external servers, does not collect telemetry, and always creates local snapshots before applying any change.