CleanCSS constructor accepts a hash as a parameter, i.e.,
`new CleanCSS(options).minify(source)` with the following options available:
-* `keepSpecialComments` - `*` for keeping all (default), `1` for keeping first one only, `0` for removing all
+* `benchmark` - turns on benchmarking mode measuring time spent on cleaning up (run `npm run bench` to see example)
+* `compatibility` - Force compatibility mode to `ie7` or `ie8`. Defaults to not set.
+* `debug` - set to true to get minification statistics under `stats` property (see `test/custom-test.js` for examples)
+* `inliner` - a hash of options for `@import` inliner, see test/protocol-imports-test.js for examples
* `keepBreaks` - whether to keep line breaks (default is false)
-* `benchmark` - turns on benchmarking mode measuring time spent on cleaning up
- (run `npm run bench` to see example)
-* `root` - path to __resolve__ absolute `@import` rules and __rebase__ relative URLs
-* `relativeTo` - path to __resolve__ relative `@import` rules and URLs
-* `target` - path to a folder or an output file to which __rebase__ all URLs
-* `processImport` - whether to process `@import` rules
-* `noRebase` - whether to skip URLs rebasing
+* `keepSpecialComments` - `*` for keeping all (default), `1` for keeping first one only, `0` for removing all
* `noAdvanced` - set to true to disable advanced optimizations - selector & property merging, reduction, etc.
+* `noAggressiveMerging` - set to true to disable aggressive merging of properties.
+* `noRebase` - whether to skip URLs rebasing
+* `processImport` - whether to process `@import` rules
+* `relativeTo` - path to __resolve__ relative `@import` rules and URLs
+* `root` - path to __resolve__ absolute `@import` rules and __rebase__ relative URLs
* `roundingPrecision` - Rounding precision, defaults to 2.
-* `compatibility` - Force compatibility mode to `ie7` or `ie8`. Defaults to not set.
-* `debug` - set to true to get minification statistics under `stats` property (see `test/custom-test.js` for examples)
+* `target` - path to a folder or an output file to which __rebase__ all URLs
### How to use clean-css with build tools?
var CleanCSS = module.exports = function CleanCSS(options) {
options = options || {};
- options.keepBreaks = options.keepBreaks || false;
-
- //active by default
- if (undefined === options.processImport)
- options.processImport = true;
+ this.options = {
+ benchmark: options.benchmark,
+ compatibility: options.compatibility,
+ debug: options.debug,
+ inliner: options.inliner,
+ keepBreaks: options.keepBreaks || false,
+ keepSpecialComments: 'keepSpecialComments' in options ? options.keepSpecialComments : '*',
+ noAdvanced: options.noAdvanced,
+ noAggressiveMerging: options.noAggressiveMerging,
+ noRebase: options.noRebase,
+ processImport: undefined === options.processImport ? true : false,
+ relativeTo: options.relativeTo,
+ root: options.root,
+ roundingPrecision: options.roundingPrecision,
+ target: options.target
+ };
- this.options = options;
this.stats = {};
this.context = {
errors: [],
var options = this.options;
var context = this.context;
- var commentsProcessor = new CommentsProcessor('keepSpecialComments' in options ? options.keepSpecialComments : '*', options.keepBreaks);
+ var commentsProcessor = new CommentsProcessor(options.keepSpecialComments, options.keepBreaks);
var expressionsProcessor = new ExpressionsProcessor();
var freeTextProcessor = new FreeTextProcessor();
var urlsProcessor = new UrlsProcessor();