cssnano 2.3.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/bin/usage.txt +12 -13
- package/index.js +50 -31
- package/lib/functionOptimiser.js +1 -5
- package/lib/warnOnce.js +11 -0
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
# 2.6.1
|
|
2
|
+
|
|
3
|
+
* Improved performance of the core module `functionOptimiser`.
|
|
4
|
+
|
|
5
|
+
# 2.6.0
|
|
6
|
+
|
|
7
|
+
* Adds a new optimisation which re-orders properties that accept values in
|
|
8
|
+
an arbitrary order. This can lead to improved merging behaviour in certain
|
|
9
|
+
cases.
|
|
10
|
+
|
|
11
|
+
# 2.5.0
|
|
12
|
+
|
|
13
|
+
* Adds support for disabling modules of the user's choosing, with new option
|
|
14
|
+
names. The old options (such as `merge` & `fonts`) will be removed in `3.0`.
|
|
15
|
+
|
|
16
|
+
# 2.4.0
|
|
17
|
+
|
|
18
|
+
* postcss-minify-selectors was extended to add support for conversion of
|
|
19
|
+
`::before` to `:before`; this release removes the dedicated
|
|
20
|
+
postcss-pseudoelements module.
|
|
21
|
+
|
|
1
22
|
# 2.3.0
|
|
2
23
|
|
|
3
24
|
* Consolidated postcss-minify-trbl & two integrated modules into
|
package/bin/usage.txt
CHANGED
|
@@ -4,19 +4,18 @@ Options:
|
|
|
4
4
|
|
|
5
5
|
--sourcemap, -s Generate a sourcemap within the minified output.
|
|
6
6
|
|
|
7
|
-
--no-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
--no-unused Disable unused at-rule removal.
|
|
7
|
+
--no-[featureName] Disable any individual processor module by its name.
|
|
8
|
+
[featureName] can be any one of these:
|
|
9
|
+
|
|
10
|
+
autoprefixer filterOptimiser normalizeUrl
|
|
11
|
+
calc filterPlugins orderedValues
|
|
12
|
+
colormin fontFamily reduceIdents
|
|
13
|
+
convertValues functionOptimiser singleCharset
|
|
14
|
+
core mergeIdents styleCache
|
|
15
|
+
discardComments mergeLonghand uniqueSelectors
|
|
16
|
+
discardDuplicates mergeRules zindex
|
|
17
|
+
discardEmpty minifyFontWeight
|
|
18
|
+
discardUnused minifySelectors
|
|
20
19
|
|
|
21
20
|
--version, -v Outputs the version number.
|
|
22
21
|
|
package/index.js
CHANGED
|
@@ -1,37 +1,40 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var decamelize = require('decamelize');
|
|
4
|
+
var defined = require('defined');
|
|
3
5
|
var postcss = require('postcss');
|
|
6
|
+
var warnOnce = require('./lib/warnOnce');
|
|
4
7
|
|
|
5
8
|
var processors = {
|
|
6
|
-
|
|
9
|
+
postcssFilterPlugins: function () {
|
|
7
10
|
return require('postcss-filter-plugins')({silent: true});
|
|
8
11
|
},
|
|
9
|
-
|
|
10
|
-
autoprefixer:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
postcssDiscardComments: {fn: require('postcss-discard-comments'), ns: 'comments'},
|
|
13
|
+
autoprefixer: require('autoprefixer-core'),
|
|
14
|
+
postcssZindex: {fn: require('postcss-zindex')},
|
|
15
|
+
postcssMinifyFontWeight: require('postcss-minify-font-weight'),
|
|
16
|
+
postcssConvertValues: require('postcss-convert-values'),
|
|
17
|
+
postcssCalc: {fn: require('postcss-calc')},
|
|
18
|
+
postcssColormin: require('postcss-colormin'),
|
|
19
|
+
postcssOrderedValues: require('postcss-ordered-values'),
|
|
17
20
|
filterOptimiser: require('./lib/filterOptimiser'),
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
postcssMinifySelectors: require('postcss-minify-selectors'),
|
|
22
|
+
postcssSingleCharset: require('postcss-single-charset'),
|
|
20
23
|
// font-family should be run before discard-unused
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
postcssFontFamily: {fn: require('postcss-font-family'), ns: 'fonts'},
|
|
25
|
+
postcssDiscardUnused: {fn: require('postcss-discard-unused'), ns: 'unused'},
|
|
26
|
+
postcssNormalizeUrl: {fn: require('postcss-normalize-url'), ns: 'urls'},
|
|
24
27
|
core: require('./lib/core'),
|
|
25
28
|
// Optimisations after this are sensitive to previous optimisations in
|
|
26
29
|
// the pipe, such as whitespace normalising/selector re-ordering
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
postcssMergeIdents: {fn: require('postcss-merge-idents'), ns: 'idents'},
|
|
31
|
+
postcssReduceIdents: {fn: require('postcss-reduce-idents'), ns: 'idents'},
|
|
32
|
+
postcssMergeLonghand: require('postcss-merge-longhand'),
|
|
33
|
+
postcssDiscardDuplicates: require('postcss-discard-duplicates'),
|
|
31
34
|
functionOptimiser: require('./lib/functionOptimiser'),
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
postcssMergeRules: {fn: require('postcss-merge-rules'), ns: 'merge'},
|
|
36
|
+
postcssDiscardEmpty: require('postcss-discard-empty'),
|
|
37
|
+
postcssUniqueSelectors: require('postcss-unique-selectors'),
|
|
35
38
|
styleCache: require('./lib/styleCache')
|
|
36
39
|
};
|
|
37
40
|
|
|
@@ -46,19 +49,35 @@ var cssnano = postcss.plugin('cssnano', function (options) {
|
|
|
46
49
|
while (i < len) {
|
|
47
50
|
var plugin = plugins[i++];
|
|
48
51
|
var processor = processors[plugin];
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
var method = processor;
|
|
53
|
+
|
|
54
|
+
var shortName = plugin.replace('postcss', '');
|
|
55
|
+
shortName = shortName.slice(0, 1).toLowerCase() + shortName.slice(1);
|
|
56
|
+
|
|
57
|
+
if (typeof processor !== 'function') {
|
|
58
|
+
if (typeof options[processor.ns] !== 'undefined') {
|
|
59
|
+
warnOnce('The ' + processor.ns + ' option is deprecated. ' +
|
|
60
|
+
'Please use options.' + shortName + ' instead.');
|
|
61
|
+
options[plugin] = options[processor.ns];
|
|
59
62
|
}
|
|
60
63
|
method = processor.fn;
|
|
61
64
|
}
|
|
65
|
+
|
|
66
|
+
var opts = defined(
|
|
67
|
+
options[shortName],
|
|
68
|
+
options[plugin],
|
|
69
|
+
options[decamelize(plugin, '-')],
|
|
70
|
+
{}
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
if (opts === false || opts.disable) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (plugin === 'autoprefixer') {
|
|
78
|
+
opts.add = false;
|
|
79
|
+
}
|
|
80
|
+
|
|
62
81
|
proc.use(method(opts));
|
|
63
82
|
}
|
|
64
83
|
|
package/lib/functionOptimiser.js
CHANGED
|
@@ -9,9 +9,7 @@ var functions = [
|
|
|
9
9
|
'calc',
|
|
10
10
|
'cubic-bezier',
|
|
11
11
|
'gradient',
|
|
12
|
-
'hsl',
|
|
13
12
|
'rect',
|
|
14
|
-
'rgb',
|
|
15
13
|
'rotate3d',
|
|
16
14
|
'scale',
|
|
17
15
|
'scale3d',
|
|
@@ -44,8 +42,6 @@ function optimise (decl) {
|
|
|
44
42
|
|
|
45
43
|
module.exports = postcss.plugin('cssnano-function-optimiser', function () {
|
|
46
44
|
return function (css) {
|
|
47
|
-
|
|
48
|
-
css.eachDecl(optimise);
|
|
49
|
-
});
|
|
45
|
+
css.eachDecl(optimise);
|
|
50
46
|
};
|
|
51
47
|
});
|
package/lib/warnOnce.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cssnano",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "A modular minifier, built on top of the PostCSS ecosystem.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"autoprefixer-core": "^5.2.1",
|
|
30
30
|
"balanced-match": "^0.2.0",
|
|
31
31
|
"css-list": "^0.1.2",
|
|
32
|
-
"
|
|
32
|
+
"decamelize": "^1.0.0",
|
|
33
|
+
"defined": "^1.0.0",
|
|
33
34
|
"indexes-of": "^1.0.1",
|
|
34
35
|
"minimist": "^1.1.3",
|
|
35
36
|
"postcss": "^4.1.16",
|
|
@@ -43,12 +44,12 @@
|
|
|
43
44
|
"postcss-filter-plugins": "^1.0.0",
|
|
44
45
|
"postcss-font-family": "^1.2.1",
|
|
45
46
|
"postcss-merge-idents": "^1.0.1",
|
|
46
|
-
"postcss-merge-longhand": "^1.0.
|
|
47
|
-
"postcss-merge-rules": "^1.3.
|
|
47
|
+
"postcss-merge-longhand": "^1.0.1",
|
|
48
|
+
"postcss-merge-rules": "^1.3.5",
|
|
48
49
|
"postcss-minify-font-weight": "^1.0.1",
|
|
49
|
-
"postcss-minify-selectors": "^1.
|
|
50
|
+
"postcss-minify-selectors": "^1.5.0",
|
|
50
51
|
"postcss-normalize-url": "^2.1.1",
|
|
51
|
-
"postcss-
|
|
52
|
+
"postcss-ordered-values": "^1.0.1",
|
|
52
53
|
"postcss-reduce-idents": "^1.0.2",
|
|
53
54
|
"postcss-single-charset": "^0.3.0",
|
|
54
55
|
"postcss-unique-selectors": "^1.0.0",
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
"json-loader": "^0.5.2",
|
|
62
63
|
"node-libs-browser": "^0.5.2",
|
|
63
64
|
"tap-spec": "^4.0.2",
|
|
64
|
-
"tape": "^4.
|
|
65
|
+
"tape": "^4.2.0",
|
|
65
66
|
"webpack": "^1.11.0"
|
|
66
67
|
},
|
|
67
68
|
"homepage": "https://github.com/ben-eb/cssnano",
|