Socket
Socket
Sign inDemoInstall

postcss-colormin

Package Overview
Dependencies
Maintainers
2
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-colormin - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

6

CHANGELOG.md

@@ -0,1 +1,7 @@

# 2.2.1
* Resolves an issue where converting an rgb/hsl function next to another token,
such as `linear-gradient(rgb(10, 10, 10)0%, blue)` would result in a
mangled value.
# 2.2.0

@@ -2,0 +8,0 @@

21

dist/index.js

@@ -27,2 +27,11 @@ 'use strict';

function walk(parent, callback) {
parent.nodes.forEach(function (node, index) {
var bubble = callback(node, index, parent);
if (node.nodes && bubble !== false) {
walk(node, callback);
}
});
}
function transform(decl, opts) {

@@ -39,7 +48,14 @@ if (decl.prop === '-webkit-tap-highlight-color') {

}
decl.value = (0, _postcssValueParser2.default)(decl.value).walk(function (node) {
var ast = (0, _postcssValueParser2.default)(decl.value);
walk(ast, function (node, index, parent) {
if (node.type === 'function') {
if (/^(rgb|hsl)a?$/.test(node.value)) {
var value = node.value;
node.value = (0, _colormin2.default)((0, _postcssValueParser.stringify)(node), opts);
node.type = 'word';
var next = parent.nodes[index + 1];
if (node.value !== value && next && next.type === 'word') {
parent.nodes.splice(index + 1, 0, { type: 'space', value: ' ' });
}
} else if (node.value === 'calc') {

@@ -51,3 +67,4 @@ return false;

}
}).toString();
});
decl.value = ast.toString();
}

@@ -54,0 +71,0 @@

21

package.json
{
"name": "postcss-colormin",
"version": "2.2.0",
"version": "2.2.1",
"description": "Minify colors in your CSS files with PostCSS.",

@@ -11,5 +11,6 @@ "main": "dist/index.js",

"scripts": {
"lint": "eslint src",
"pretest": "eslint src",
"prepublish": "del-cli dist && babel src --out-dir dist --ignore /__tests__/",
"test": "npm run lint && babel src --out-dir dist && ava dist/__tests__"
"test": "ava src/__tests__",
"test-012": "ava src/__tests__"
},

@@ -27,12 +28,15 @@ "keywords": [

"devDependencies": {
"ava": "^0.12.0",
"ava": "^0.16.0",
"babel-cli": "^6.3.17",
"babel-core": "^6.3.26",
"babel-plugin-add-module-exports": "^0.1.2",
"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": "^2.0.0",
"eslint-config-cssnano": "^2.0.0"
"eslint": "^3.0.0",
"eslint-config-cssnano": "^3.0.0",
"eslint-plugin-babel": "^3.3.0",
"eslint-plugin-import": "^1.10.2"
},

@@ -53,3 +57,6 @@ "homepage": "https://github.com/ben-eb/postcss-colormin",

"extends": "cssnano"
},
"ava": {
"require": "babel-register"
}
}
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc