Recursively minifies CSS files starting from one or more source paths.
This asynchronous function walks the provided source path(s) (files or directories),
finds files with the ".css" extension, and replaces each CSS file's contents with
a minified version produced by PostCSS + cssnano. Directory traversal is performed
iteratively and files are processed sequentially (no parallel writes).
Behavior and important details:
The options.src value may be a single string path or an array of string paths.
If a path points to a file, it is processed only when its extension is ".css".
If a path points to a directory, the directory is read and its entries are enqueued
for processing. By default, directories named "node_modules" are skipped unless
options.includeNodeModules is true.
File reads and writes use UTF-8 encoding. Existing CSS files are overwritten in place.
Errors obtained while calling stat are logged via options.logger.Warn and the
path is skipped; other IO/processing errors are surfaced via thrown exceptions
from the underlying async operations unless caught by callers.
The function logs successful minification via options.logger.Info and warnings
(e.g., ignored node_modules or stat errors) via options.logger.Warn.
Parameters (IOptions shape summary):
options.src: string | string[] — one or more filesystem paths (files or directories)
options.includeNodeModules?: boolean — when true, traverses into "node_modules" directories
Configuration options for the minification run (see summary above).
Returns Promise<void>
A Promise that resolves when all provided paths have been processed.
Remarks
This function performs destructive updates (overwrites CSS files). Ensure you have backups
or version control in place if you need to preserve original files.
The function is intentionally sequential: if you require parallel processing for performance,
perform concurrency control externally.
Recursively minifies CSS files starting from one or more source paths.
This asynchronous function walks the provided source path(s) (files or directories), finds files with the ".css" extension, and replaces each CSS file's contents with a minified version produced by PostCSS + cssnano. Directory traversal is performed iteratively and files are processed sequentially (no parallel writes).
Behavior and important details:
options.srcvalue may be a single string path or an array of string paths.options.includeNodeModulesis true.statare logged viaoptions.logger.Warnand the path is skipped; other IO/processing errors are surfaced via thrown exceptions from the underlying async operations unless caught by callers.options.logger.Infoand warnings (e.g., ignored node_modules or stat errors) viaoptions.logger.Warn.Parameters (IOptions shape summary):