postcss-colormin
Advanced tools
Comparing version 2.2.2 to 4.0.0-rc.0
@@ -0,1 +1,16 @@ | ||
# 4.0.0-rc.0 | ||
* Breaking: Drops support for Node 0.12, we now require at least Node 4. | ||
* Breaking: Drops the `legacy` option which was used to provide support for | ||
legacy IE versions. It has been superseded by using Browserslist to supply | ||
a list of browsers; we recommend using the config file as the same values will | ||
be propagated to other cssnano plugins which have the same functionality. | ||
See https://github.com/ai/browserslist#config-file for more details. | ||
* Breaking: Update PostCSS to 6.0.0. | ||
* postcss-colormin will now no longer handle integer or whitespace compression; | ||
it's now delegated to postcss-normalize-whitespace & postcss-convert-values. | ||
We re-integrated colormin back into this module so that it would be clearer | ||
what postcss-colormin's responsibilities are; which are to facilitate | ||
conversion between identical colors. | ||
# 2.2.2 | ||
@@ -2,0 +17,0 @@ |
'use strict'; | ||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _browserslist = require('browserslist'); | ||
var _browserslist2 = _interopRequireDefault(_browserslist); | ||
var _postcss = require('postcss'); | ||
@@ -13,16 +19,8 @@ | ||
var _colormin = require('colormin'); | ||
var _colours = require('./colours'); | ||
var _colormin2 = _interopRequireDefault(_colormin); | ||
var _colours2 = _interopRequireDefault(_colours); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function reduceWhitespaces(decl) { | ||
decl.value = (0, _postcssValueParser2.default)(decl.value).walk(function (node) { | ||
if (node.type === 'function' || node.type === 'div') { | ||
node.before = node.after = ''; | ||
} | ||
}).toString(); | ||
} | ||
function walk(parent, callback) { | ||
@@ -37,13 +35,6 @@ parent.nodes.forEach(function (node, index) { | ||
function transform(decl, opts) { | ||
if (decl.prop === '-webkit-tap-highlight-color') { | ||
if (decl.value === 'inherit' || decl.value === 'transparent') { | ||
return; | ||
} | ||
reduceWhitespaces(decl); | ||
function transform(legacy, decl) { | ||
if (/^(composes|font|filter|-webkit-tap-highlight-color)/i.test(decl.prop)) { | ||
return; | ||
} | ||
if (/^(composes|font|filter)/i.test(decl.prop)) { | ||
return; | ||
} | ||
var ast = (0, _postcssValueParser2.default)(decl.value); | ||
@@ -55,3 +46,3 @@ walk(ast, function (node, index, parent) { | ||
node.value = (0, _colormin2.default)((0, _postcssValueParser.stringify)(node), opts); | ||
node.value = (0, _colours2.default)((0, _postcssValueParser.stringify)(node), legacy); | ||
node.type = 'word'; | ||
@@ -65,4 +56,4 @@ var next = parent.nodes[index + 1]; | ||
} | ||
} else { | ||
node.value = (0, _colormin2.default)(node.value, opts); | ||
} else if (node.type === 'word') { | ||
node.value = (0, _colours2.default)(node.value, legacy); | ||
} | ||
@@ -73,11 +64,23 @@ }); | ||
/* | ||
* IE 8 & 9 do not properly handle clicks on elements | ||
* with a `transparent` `background-color`. | ||
* | ||
* https://developer.mozilla.org/en-US/docs/Web/Events/click#Internet_Explorer | ||
*/ | ||
function hasTransparentBug(browser) { | ||
return ~['ie 8', 'ie 9'].indexOf(browser); | ||
} | ||
exports.default = _postcss2.default.plugin('postcss-colormin', function () { | ||
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
return function (css) { | ||
return css.walkDecls(function (node) { | ||
return transform(node, opts); | ||
return function (css, result) { | ||
var resultOpts = result.opts || {}; | ||
var browsers = (0, _browserslist2.default)(null, { | ||
stats: resultOpts.stats, | ||
path: __dirname, | ||
env: resultOpts.env | ||
}); | ||
css.walkDecls(transform.bind(null, browsers.some(hasTransparentBug))); | ||
}; | ||
}); | ||
module.exports = exports['default']; | ||
}); |
{ | ||
"name": "postcss-colormin", | ||
"version": "2.2.2", | ||
"version": "4.0.0-rc.0", | ||
"description": "Minify colors in your CSS files with PostCSS.", | ||
@@ -11,6 +11,3 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"pretest": "eslint src", | ||
"prepublish": "del-cli dist && babel src --out-dir dist --ignore /__tests__/", | ||
"test": "ava src/__tests__", | ||
"test-012": "ava src/__tests__" | ||
"prepublish": "cross-env BABEL_ENV=publish babel-node ./src/generate.js && babel src --out-dir dist --ignore /__tests__/,src/generate.js" | ||
}, | ||
@@ -28,17 +25,8 @@ "keywords": [ | ||
"devDependencies": { | ||
"ava": "^0.17.0", | ||
"babel-cli": "^6.3.17", | ||
"babel-core": "^6.3.26", | ||
"babel-plugin-add-module-exports": "^0.2.0", | ||
"babel-preset-es2015": "^6.3.13", | ||
"babel-preset-es2015-loose": "^7.0.0", | ||
"babel-preset-stage-0": "^6.3.13", | ||
"babel-register": "^6.9.0", | ||
"del-cli": "^0.2.0", | ||
"eslint": "^3.0.0", | ||
"eslint-config-cssnano": "^3.0.0", | ||
"eslint-plugin-babel": "^3.3.0", | ||
"eslint-plugin-import": "^2.0.1" | ||
"babel-cli": "^6.0.0", | ||
"cross-env": "^3.0.0", | ||
"css-color-names": "0.0.4", | ||
"write-file": "^1.0.0" | ||
}, | ||
"homepage": "https://github.com/ben-eb/postcss-colormin", | ||
"homepage": "https://github.com/ben-eb/cssnano", | ||
"author": { | ||
@@ -49,14 +37,16 @@ "name": "Ben Briggs", | ||
}, | ||
"repository": "ben-eb/postcss-colormin", | ||
"repository": "ben-eb/cssnano", | ||
"dependencies": { | ||
"colormin": "^1.0.5", | ||
"postcss": "^5.0.13", | ||
"postcss-value-parser": "^3.2.3" | ||
"browserslist": "^2.0.0", | ||
"color": "^1.0.0", | ||
"has": "^1.0.0", | ||
"postcss": "^6.0.0", | ||
"postcss-value-parser": "^3.0.0" | ||
}, | ||
"eslintConfig": { | ||
"extends": "cssnano" | ||
"bugs": { | ||
"url": "https://github.com/ben-eb/cssnano/issues" | ||
}, | ||
"ava": { | ||
"require": "babel-register" | ||
"engines": { | ||
"node": ">=4" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# [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] | ||
# [postcss][postcss]-colormin | ||
@@ -29,24 +29,13 @@ > Minify colors in your CSS files with PostCSS. | ||
## API | ||
## Usage | ||
### colormin([options]) | ||
See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for | ||
examples for your environment. | ||
#### options | ||
##### legacy | ||
## Contributors | ||
Type: `boolean` | ||
Default: `false` | ||
See [CONTRIBUTORS.md](https://github.com/ben-eb/cssnano/blob/master/CONTRIBUTORS.md). | ||
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 | ||
Pull requests are welcome. If you add functionality, then please add unit tests | ||
to cover it. | ||
## License | ||
@@ -57,5 +46,2 @@ | ||
[ci]: https://travis-ci.org/ben-eb/postcss-colormin | ||
[deps]: https://gemnasium.com/ben-eb/postcss-colormin | ||
[npm]: http://badge.fury.io/js/postcss-colormin | ||
[postcss]: https://github.com/postcss/postcss |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
11192
4
8
141
0
5
46
+ Addedbrowserslist@^2.0.0
+ Addedcolor@^1.0.0
+ Addedhas@^1.0.0
+ Addedansi-styles@3.2.1(transitive)
+ Addedbrowserslist@2.11.3(transitive)
+ Addedcaniuse-lite@1.0.30001636(transitive)
+ Addedchalk@2.4.2(transitive)
+ Addedcolor@1.0.3(transitive)
+ Addedcolor-string@1.9.1(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedis-arrayish@0.3.2(transitive)
+ Addedpostcss@6.0.23(transitive)
+ Addedsimple-swizzle@0.2.2(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedsupports-color@5.5.0(transitive)
- Removedcolormin@^1.0.5
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedchalk@1.1.3(transitive)
- Removedclone@1.0.4(transitive)
- Removedcolor@0.11.4(transitive)
- Removedcolor-string@0.3.0(transitive)
- Removedcolormin@1.1.2(transitive)
- Removedcss-color-names@0.0.4(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedhas-flag@1.0.0(transitive)
- Removedjs-base64@2.6.4(transitive)
- Removedpostcss@5.2.18(transitive)
- Removedsource-map@0.5.7(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedsupports-color@2.0.03.2.3(transitive)
Updatedpostcss@^6.0.0
Updatedpostcss-value-parser@^3.0.0