Socket
Socket
Sign inDemoInstall

postcss-colormin

Package Overview
Dependencies
18
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.2.2 to 4.0.0-rc.0

dist/colours.js

15

CHANGELOG.md

@@ -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 @@

63

dist/index.js
'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
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc