Lines Matching +full:- +full:- +full:strip +full:- +full:components
3 …<img src="https://cdn.rawgit.com/jakubpawlowicz/clean-css/master/logo.v2.svg" alt="clean-css logo"…
8 …NPM version](https://img.shields.io/npm/v/clean-css.svg?style=flat)](https://www.npmjs.com/package…
9 …io/travis/jakubpawlowicz/clean-css/master.svg?style=flat&label=Linux%20build)](https://travis-ci.o…
10 …/ci/jakubpawlowicz/clean-css/master.svg?style=flat&label=Windows%20build)](https://ci.appveyor.com…
11 …://img.shields.io/david/jakubpawlowicz/clean-css.svg?style=flat)](https://david-dm.org/jakubpawlow…
12 [](https://npmcharts.com/compare/clean…
13 [](https://twitter.com/cleancss)
15 …n-css is a fast and efficient CSS optimizer for [Node.js](http://nodejs.org/) platform and [any mo…
17 According to [tests](http://goalsmashers.github.io/css-minification-benchmark/) it is one of the be…
21 - [Node.js version support](#nodejs-version-support)
22 - [Install](#install)
23 - [Use](#use)
24 * [Important: 4.0 breaking changes](#important-40-breaking-changes)
25 * [What's new in version 4.1](#whats-new-in-version-41)
26 * [What's new in version 4.2](#whats-new-in-version-42)
27 * [Constructor options](#constructor-options)
28 * [Compatibility modes](#compatibility-modes)
29 * [Fetch option](#fetch-option)
30 * [Formatting options](#formatting-options)
31 * [Inlining options](#inlining-options)
32 * [Optimization levels](#optimization-levels)
33 + [Level 0 optimizations](#level-0-optimizations)
34 + [Level 1 optimizations](#level-1-optimizations)
35 + [Level 2 optimizations](#level-2-optimizations)
36 * [Minify method](#minify-method)
37 * [Promise interface](#promise-interface)
38 * [CLI utility](#cli-utility)
39 - [FAQ](#faq)
40 * [How to optimize multiple files?](#how-to-optimize-multiple-files)
41 * [How to process remote `@import`s correctly?](#how-to-process-remote-imports-correctly)
42 …pply arbitrary transformations to CSS properties?](#how-to-apply-arbitrary-transformations-to-css-…
43 * [How to specify a custom rounding precision?](#how-to-specify-a-custom-rounding-precision)
44 * [How to keep a CSS fragment intact?](#how-to-keep-a-css-fragment-intact)
45 * [How to preserve a comment block?](#how-to-preserve-a-comment-block)
46 * [How to rebase relative image URLs?](#how-to-rebase-relative-image-urls)
47 * [How to work with source maps?](#how-to-work-with-source-maps)
48 …ply level 1 & 2 optimizations at the same time?](#how-to-apply-level-1--2-optimizations-at-the-sam…
49 * [What level 2 optimizations do?](#what-level-2-optimizations-do)
50 * [How to use clean-css with build tools?](#how-to-use-clean-css-with-build-tools)
51 * [How to use clean-css from web browser?](#how-to-use-clean-css-from-web-browser)
52 - [Contributing](#contributing)
53 * [How to get started?](#how-to-get-started)
54 - [Acknowledgments](#acknowledgments)
55 - [License](#license)
59 clean-css requires Node.js 4.0+ (tested on Linux, OS X, and Windows)
64 npm install --save-dev clean-css
70 var CleanCSS = require('clean-css');
71 var input = 'a{font-weight:bold;}';
78 clean-css 4.0 introduces some breaking changes:
80 …tays in this repository while CLI moves to [clean-css-cli](https://github.com/jakubpawlowicz/clean…
81 * `root`, `relativeTo`, and `target` options are replaced by a single `rebaseTo` option - this mean…
94 * `keepBreaks` option is replaced with `{ format: 'keep-breaks' }` to ease transition;
95 * `sourceMap` option has to be a boolean from now on - to specify an input source map pass it a 2nd…
100 clean-css 4.1 introduces the following changes / features:
110 * new `font` shorthand and `font-*` longhand optimizers;
113 * new `animation` shorthand and `animation-*` longhand optimizers;
114 …tRules` level 2 optimization controlling removal of unused `@counter-style`, `@font-face`, `@keyfr…
115 * the [web interface](https://jakubpawlowicz.github.io/clean-css) gets an improved settings panel w…
119 clean-css 4.2 introduces the following changes / features:
121 * Adds `process` method for compatibility with optimize-css-assets-webpack-plugin;
123 * preserves any CSS content between `/* clean-css ignore:start */` and `/* clean-css ignore:end */`…
124 …on selector in `transform` callback, see [example](#how-to-apply-arbitrary-transformations-to-css-…
129 clean-css constructor accepts a hash as a parameter with the following options available:
131 * `compatibility` - controls compatibility mode used; defaults to `ie10+`; see [compatibility modes…
132 * `fetch` - controls a function for handling remote requests; see [fetch option](#fetch-option) for…
133 * `format` - controls output CSS formatting; defaults to `false`; see [formatting options](#formatt…
134 * `inline` - controls `@import` inlining rules; defaults to `'local'`; see [inlining options](#inli…
135 * `inlineRequest` - controls extra options for inlining remote `@import` rules, can be any of [HTTP…
136 * `inlineTimeout` - controls number of milliseconds after which inlining a remote `@import` fails; …
137 * `level` - controls optimization level used; defaults to `1`; see [optimization levels](#optimizat…
138 * `rebase` - controls URL rebasing; defaults to `true`;
139 * `rebaseTo` - controls a directory to which all URLs are rebased, most likely the directory under …
140 …returnPromise` - controls whether `minify` method returns a Promise object or not; defaults to `fa…
141 * `sourceMap` - controls whether an output source map is built; defaults to `false`;
142 * `sourceMapInlineSources` - controls embedding sources inside a source map's `sourcesContent` fiel…
148 * `new CleanCSS({ compatibility: '*' })` (default) - Internet Explorer 10+ compatibility mode
149 * `new CleanCSS({ compatibility: 'ie9' })` - Internet Explorer 9+ compatibility mode
150 * `new CleanCSS({ compatibility: 'ie8' })` - Internet Explorer 8+ compatibility mode
151 * `new CleanCSS({ compatibility: 'ie7' })` - Internet Explorer 7+ compatibility mode
153 …as to a [fine grained configuration](https://github.com/jakubpawlowicz/clean-css/blob/master/lib/o…
162 backgroundClipMerging: true, // controls background-clip merging into shorthand
163 backgroundOriginMerging: true, // controls background-origin merging into shorthand
164 backgroundSizeMerging: true, // controls background-size merging into shorthand
167 ieFilters: false, // controls keeping IE `filter` / `-ms-filter`
172 …Brace: true, // controls keeping space after closing brace - `url() no-repeat` into `url()no-repea…
203 …compatibility: 'ie9,-properties.merging' // sets compatibility to IE9 mode with disabled property …
231 …dRemoteResource](https://github.com/jakubpawlowicz/clean-css/blob/master/lib/reader/load-remote-re…
248 …format: 'keep-breaks' // formats output the default way but adds line breaks for improved readabil…
252 however `format` option also accept a fine-grained set of options:
258 …afterAtRule: false, // controls if a line break comes after an at-rule; e.g. `@charset`; defaults …
298 // introduced in clean-css 4.1.0
333 or a fine-grained configuration given via a hash.
354 … optimizeBorderRadius: true, // controls `border-radius` property optimizations; defaults to `true`
357 optimizeFontWeight: true, // controls `font-weight` property optimizations; defaults to `true`
369 …tidyAtRules: true, // controls at-rules (e.g. `@charset`, `@import`) optimizing; defaults to `true`
372 …operty: false, // controls removing trailing semicolons in rule; defaults to `false` - means remove
373 …nsform: function () {} // defines a callback for fine-grained property optimization; defaults to n…
407 mergeNonAdjacentRules: true, // controls non-adjacent rule merging; defaults to true
411 reduceNonAdjacentRules: true, // controls non-adjacent rule reducing; defaults to true
412 removeDuplicateFontRules: true, // controls duplicate `@font-face` removing; defaults to true
438 Once configured clean-css provides a `minify` method to optimize a given CSS, e.g.
454 console.log(output.stats.efficiency); // `(originalSize - minifiedSize) / originalSize`, e.g. 0.25 …
473 If you prefer clean-css to return a Promise object then you need to explicitely ask for it, e.g.
484 …-css has an associated command line utility that can be installed separately using `npm install cl…
514 …order of object properties](http://2ality.com/2015/10/property-traversal-order-es6.html) - availab…
516 Important note - any `@import` rules already present in the hash will be resolved in memory.
533 If clean-css doesn't perform a particular property optimization, you can use `transform` callback t…
536 var source = '.block{background-image:url(/path/to/image.png)}';
540 …form: function (propertyName, propertyValue, selector /* `selector` available since 4.2.0-pre */) {
541 if (propertyName == 'background-image' && propertyValue.indexOf('/path/to') > -1) {
549 console.log(output.styles); # => .block{background-image:url(../valid/path/to/image.png)}
556 The level 1 `roundingPrecision` optimization option accept a string with per-unit rounding precisio…
574 Wrap the CSS fragment in special comments which instruct clean-css to preserve it, e.g.
577 .block-1 {
580 /* clean-css ignore:start */
581 .block-special {
584 /* clean-css ignore:end */
585 .block-2 {
593 .block-1{color:red}
594 .block-special {
597 .block-2{margin:0}
612 clean-css will handle it automatically for you in the following cases:
626 // see https://github.com/mozilla/source-map/#sourcemapgenerator for more details
636 // see https://github.com/mozilla/source-map/#sourcemapgenerator for more details
646 sourceMap: '...source-map...'
650 sourceMap: '...source-map...'
679 … dispatched [here](https://github.com/jakubpawlowicz/clean-css/blob/master/lib/optimizer/level-2/o…
681 * `recursivelyOptimizeBlocks` - does all the following operations on a nested block, like `@media` …
682 …- optimizes properties in rulesets and flat at-rules, like @font-face, by splitting them into comp…
683 * `removeDuplicates` - gets rid of duplicate rulesets with exactly the same set of properties, e.g.…
684 * `mergeAdjacent` - merges adjacent rulesets with the same selector or rules;
685 * `reduceNonAdjacent` - identifies which properties are overridden in same-selector non-adjacent ru…
686 * `mergeNonAdjacentBySelector` - identifies same-selector non-adjacent rulesets which can be moved …
687 * `mergeNonAdjacentByBody` - same as the one above but for same-selector non-adjacent rulesets;
688 …- tries to reorganize different-selector different-rules rulesets so they take less space, e.g. `.…
689 * `removeDuplicateFontAtRules` - removes duplicated `@font-face` rules;
690 * `removeDuplicateMediaQueries` - removes duplicated `@media` nested blocks;
691 * `mergeMediaQueries` - merges non-adjacent `@media` at-rules by the same rules as `mergeNonAdjacen…
693 ## How to use clean-css with build tools?
697 …ithub.com/broccolijs/broccoli#broccoli): [broccoli-clean-css](https://github.com/shinnn/broccoli-c…
698 * [Brunch](http://brunch.io/): [clean-css-brunch](https://github.com/brunch/clean-css-brunch)
699 * [Grunt](http://gruntjs.com): [grunt-contrib-cssmin](https://github.com/gruntjs/grunt-contrib-cssm…
700 * [Gulp](http://gulpjs.com/): [gulp-clean-css](https://github.com/scniro/gulp-clean-css)
701 …p](http://gulpjs.com/): [using vinyl-map as a wrapper - courtesy of @sogko](https://github.com/jak…
702 * [component-builder2](https://github.com/component/builder2.js): [builder-clean-css](https://githu…
703 …etalsmith](http://metalsmith.io): [metalsmith-clean-css](https://github.com/aymericbeaumet/metalsm…
704 * [Lasso](https://github.com/lasso-js/lasso): [lasso-clean-css](https://github.com/yomed/lasso-clea…
705 * [Start](https://github.com/start-runner/start): [start-clean-css](https://github.com/start-runner…
707 ## How to use clean-css from web browser?
709 * https://jakubpawlowicz.github.io/clean-css/ (official web interface)
710 * http://refresh-sf.com/
711 * http://adamburgess.github.io/clean-css-online/
715 See [CONTRIBUTING.md](https://github.com/jakubpawlowicz/clean-css/blob/master/CONTRIBUTING.md).
722 git clone git@github.com:jakubpawlowicz/clean-css.git
728 cd clean-css
735 npm run bench # for clean-css benchmarks (see [test/bench.js](https://github.com/jakubpawlowicz/cle…
736 npm run browserify # to create the browser-ready clean-css version
746 * [@alexlamsl](https://github.com/alexlamsl) (Alex Lam S.L.) for testing early clean-css 4 versions…
748 * [@ben-eb](https://github.com/ben-eb) (Ben Briggs) for sharing ideas about CSS optimizations;
750 * [@facelessuser](https://github.com/facelessuser) (Isaac) for pointing out a flaw in clean-css' st…
754 …Plus everyone else involved in [#125](https://github.com/jakubpawlowicz/clean-css/issues/125) for …
755 * [@madwizard-thomas](https://github.com/madwizard-thomas) for sharing ideas about `@import` inlini…
756 * [@ngyikp](https://github.com/ngyikp) (Ng Yik Phang) for testing early clean-css 4 versions, repor…
760 …) for suggesting new features, like option to remove special comments and strip out URLs quotation…
764 clean-css is released under the [MIT License](https://github.com/jakubpawlowicz/clean-css/blob/mast…