clean-css
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
source-map | 0.6.1 | 194.96 kB | BSD-3-Clause | prod |
Clean-css is a well-tested and efficient CSS optimizer for Node.js and any modern web browser. It is designed to save bandwidth and ensure faster page load times by minifying your CSS code. Based on efficiency tests, it ranks among the best available tools for this purpose.
You can use clean-css by installing it from npm using the npm install --save-dev clean-css
command.
Here is an example of how to use clean-css in your code:
var CleanCSS = require('clean-css');
var input = 'a{font-weight:bold;}';
var options = { /* options */ };
var output = new CleanCSS(options).minify(input);
In this snippet, CleanCSS is first imported into the file. Then, a raw CSS string is saved to the input
variable and options for clean-css are defined in options
. Finally, the CleanCSS
object is used to minify the CSS string by calling new CleanCSS(options).minify(input);
The minified CSS is then stored in the output
variable.
You can find the clean-css documentation in the GitHub repository at https://github.com/clean-css/clean-css. It includes a detailed explanation of each feature, complete with usage instructions and examples.
Please note that while the package's readme does provide a lot of information about its usage and configuration, it's important to also check out the Github repository directly, as it provides a richer source of useful resources such as the FAQ section and numerous code examples.