postcss-colormin
Advanced tools
Comparing version 2.1.8 to 2.2.0
@@ -0,1 +1,5 @@ | ||
# 2.2.0 | ||
* Adds support for legacy IE versions (< 10). | ||
# 2.1.8 | ||
@@ -2,0 +6,0 @@ |
@@ -27,3 +27,3 @@ 'use strict'; | ||
function transform(decl) { | ||
function transform(decl, opts) { | ||
if (decl.prop === '-webkit-tap-highlight-color') { | ||
@@ -33,3 +33,4 @@ if (decl.value === 'inherit' || decl.value === 'transparent') { | ||
} | ||
return reduceWhitespaces(decl); | ||
reduceWhitespaces(decl); | ||
return; | ||
} | ||
@@ -42,3 +43,3 @@ if (/^(font|filter)/.test(decl.prop)) { | ||
if (/^(rgb|hsl)a?$/.test(node.value)) { | ||
node.value = (0, _colormin2.default)((0, _postcssValueParser.stringify)(node)); | ||
node.value = (0, _colormin2.default)((0, _postcssValueParser.stringify)(node), opts); | ||
node.type = 'word'; | ||
@@ -49,3 +50,3 @@ } else if (node.value === 'calc') { | ||
} else { | ||
node.value = (0, _colormin2.default)(node.value); | ||
node.value = (0, _colormin2.default)(node.value, opts); | ||
} | ||
@@ -56,6 +57,10 @@ }).toString(); | ||
exports.default = _postcss2.default.plugin('postcss-colormin', function () { | ||
var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
return function (css) { | ||
return css.walkDecls(transform); | ||
return css.walkDecls(function (node) { | ||
return transform(node, opts); | ||
}); | ||
}; | ||
}); | ||
module.exports = exports['default']; |
{ | ||
"name": "postcss-colormin", | ||
"version": "2.1.8", | ||
"version": "2.2.0", | ||
"description": "Minify colors in your CSS files with PostCSS.", | ||
@@ -12,3 +12,3 @@ "main": "dist/index.js", | ||
"lint": "eslint src", | ||
"prepublish": "de dist && babel src --out-dir dist --ignore /__tests__/", | ||
"prepublish": "del-cli dist && babel src --out-dir dist --ignore /__tests__/", | ||
"test": "npm run lint && babel src --out-dir dist && ava dist/__tests__" | ||
@@ -27,10 +27,12 @@ }, | ||
"devDependencies": { | ||
"ava": "sindresorhus/ava#945dbea40a6a500a24d54ebcc7e10dcd75647fc7", | ||
"ava": "^0.12.0", | ||
"babel-cli": "^6.3.17", | ||
"babel-core": "^6.3.26", | ||
"babel-plugin-add-module-exports": "^0.1.2", | ||
"babel-preset-es2015-loose": "^6.1.4", | ||
"babel-preset-es2015": "^6.3.13", | ||
"babel-preset-es2015-loose": "^7.0.0", | ||
"babel-preset-stage-0": "^6.3.13", | ||
"del-cli": "^0.1.2", | ||
"eslint": "^1.10.3" | ||
"del-cli": "^0.2.0", | ||
"eslint": "^2.0.0", | ||
"eslint-config-cssnano": "^2.0.0" | ||
}, | ||
@@ -48,3 +50,6 @@ "homepage": "https://github.com/ben-eb/postcss-colormin", | ||
"postcss-value-parser": "^3.2.3" | ||
}, | ||
"eslintConfig": { | ||
"extends": "cssnano" | ||
} | ||
} |
@@ -26,5 +26,21 @@ # [postcss][postcss]-colormin [![Build Status](https://travis-ci.org/ben-eb/postcss-colormin.svg?branch=master)][ci] [![NPM version](https://badge.fury.io/js/postcss-colormin.svg)][npm] [![Dependency Status](https://gemnasium.com/ben-eb/postcss-colormin.svg)][deps] | ||
For more examples see the [tests](test.js). | ||
For more examples see the [tests](src/__tests__/index.js). | ||
## API | ||
### colormin([options]) | ||
#### options | ||
##### legacy | ||
Type: `boolean` | ||
Default: `false` | ||
Set this to `true` to enable IE < 10 compatibility; the browser chokes on the | ||
`transparent` keyword, so in this mode the conversion from `rgba(0,0,0,0)` | ||
is turned off. | ||
## Contributing | ||
@@ -31,0 +47,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
7745
48
60
0
10