@fe-fast/unused-css-pruner
Version:
A powerful CSS pruning tool that removes unused styles with support for dynamic class names, CSS-in-JS, and component-level analysis
68 lines • 1.73 kB
TypeScript
import { PrunerConfig, AnalysisResult, CleanResult } from '../types.js';
export declare class CSSPruner {
private config;
private cssParser;
private sourceScanner;
constructor(config: PrunerConfig);
/**
* Analyze CSS files and find unused styles
*/
analyze(): Promise<AnalysisResult>;
/**
* Clean CSS files by removing unused styles
*/
clean(): Promise<CleanResult>;
/**
* Analyze which selectors are used vs unused
*/
private analyzeUsage;
/**
* Check if a CSS selector is used in the source code
*/
private isSelectorUsed;
/**
* Extract class names from a CSS selector
*/
private extractClassNamesFromSelector;
/**
* Check if selector is a special selector that should be kept
*/
private isSpecialSelector;
/**
* Check if selector is whitelisted
*/
private isWhitelisted;
/**
* Check if selector is blacklisted
*/
private isBlacklisted;
/**
* Remove unused selectors from CSS content using CSS AST
*/
private removeUnusedSelectors;
/**
* Extract selectors from a CSS rule node
*/
private extractSelectorsFromNode;
/**
* Fallback method for string-based removal (for compressed CSS)
*/
private removeUnusedSelectorsStringBased;
/**
* Find the boundaries of a CSS rule
*/
private findRuleBoundaries;
/**
* Log cleaning summary with intuitive statistics
*/
private logCleaningSummary;
/**
* Format bytes to human readable format
*/
private formatBytes;
/**
* Generate analysis report
*/
private generateReport;
}
//# sourceMappingURL=pruner.d.ts.map