postcss-color-function
Advanced tools
Comparing version 4.0.1 to 4.1.0
@@ -0,1 +1,7 @@ | ||
# 4.1.0 - 2019-04-01 | ||
- Added: `preserveCustomProps` option to preserve custom properties | ||
- Updated: `postcss` to 6.0.23 (patch) | ||
- Updated: `postcss-value-parser` to 3.3.1 (patch) | ||
# 4.0.1 - 2017-11-03 | ||
@@ -2,0 +8,0 @@ |
14
index.js
@@ -9,6 +9,12 @@ /** | ||
var defaultOptions = { | ||
preserveCustomProps: true, | ||
} | ||
/** | ||
* PostCSS plugin to transform color() | ||
*/ | ||
module.exports = postcss.plugin("postcss-color-function", function() { | ||
module.exports = postcss.plugin("postcss-color-function", function(options) { | ||
options = Object.assign({}, defaultOptions, options) | ||
return function(style, result) { | ||
@@ -21,2 +27,6 @@ style.walkDecls(function transformDecl(decl) { | ||
if (decl.value.indexOf("var(") !== -1) { | ||
if (!options.preserveCustomProps) { | ||
decl.remove() | ||
return | ||
} | ||
result.messages.push({ | ||
@@ -32,3 +42,3 @@ plugin: "postcss-color-function", | ||
return | ||
} | ||
} | ||
@@ -35,0 +45,0 @@ try { |
{ | ||
"name": "postcss-color-function", | ||
"version": "4.0.1", | ||
"version": "4.1.0", | ||
"description": "PostCSS plugin to transform W3C CSS color function to more compatible CSS.", | ||
@@ -21,16 +21,17 @@ "keywords": [ | ||
"css-color-function": "~1.3.3", | ||
"postcss": "^6.0.1", | ||
"postcss": "^6.0.23", | ||
"postcss-message-helpers": "^2.0.0", | ||
"postcss-value-parser": "^3.3.0" | ||
"postcss-value-parser": "^3.3.1" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^3.19.0", | ||
"faucet": "0.0.1", | ||
"npmpub": "^3.1.0", | ||
"tape": "^3.0.0" | ||
"tape": "^4.10.1" | ||
}, | ||
"scripts": { | ||
"lint": "eslint *.js index.js ./test/", | ||
"test": "npm run lint && tape test", | ||
"test": "npm run lint && tape test | faucet", | ||
"release": "npmpub" | ||
} | ||
} |
@@ -1,9 +0,19 @@ | ||
# postcss-color-function [![CSS Standard Status](https://jonathantneal.github.io/css-db/badge/css-color-modifying-colors.svg)](https://jonathantneal.github.io/css-db/#css-color-modifying-colors) [![Build Status](https://travis-ci.org/postcss/postcss-color-function.svg)](https://travis-ci.org/postcss/postcss-color-function) | ||
# postcss-color-function [![Build Status](https://travis-ci.org/postcss/postcss-color-function.svg)](https://travis-ci.org/postcss/postcss-color-function) | ||
> [PostCSS](https://github.com/postcss/postcss) plugin to transform [W3C CSS color function][specs] to more compatible CSS. | ||
[PostCSS](https://github.com/postcss/postcss) plugin to transform CSS color function from editor draft of 'Color Module Level 4' specification to more compatible CSS. | ||
## Deprecated | ||
**⚠️ `color()` was changed to `color-mod()`. See [postcss-color-mod-function](https://github.com/jonathantneal/postcss-color-mod-function).** | ||
> There is a | ||
[`color-mod`](https://github.com/jonathantneal/postcss-color-mod-function) | ||
implementation. | ||
**⚠️ `color-mod()` has been removed from [Color Module Level 4 specification](https://www.w3.org/TR/css-color-4/#changes-from-20160705).** | ||
## Installation | ||
```console | ||
$ npm install postcss-color-function | ||
npm install postcss-color-function | ||
``` | ||
@@ -23,4 +33,6 @@ | ||
// process css | ||
// set preserveCustomProps to `false` by default `true` | ||
//for delete declarations with custom properties | ||
var output = postcss() | ||
.use(colorFunction()) | ||
.use(colorFunction({preserveCustomProps: true})) | ||
.process(css) | ||
@@ -79,4 +91,2 @@ .css | ||
[Read the specs][specs] for more information. | ||
### Examples | ||
@@ -124,3 +134,1 @@ | ||
## [License](LICENSE) | ||
[specs]: http://dev.w3.org/csswg/css-color/#modifying-colors |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9214
65
132
4
1
Updatedpostcss@^6.0.23
Updatedpostcss-value-parser@^3.3.1