postcss-color-rebeccapurple
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -0,1 +1,5 @@ | ||
# 1.2.0 - 2015-07-01 | ||
- Upgrade to PostCSS 4.1.x | ||
# 1.1.0 - 2014-11-25 | ||
@@ -2,0 +6,0 @@ |
31
index.js
/** | ||
* Module dependencies. | ||
*/ | ||
var color = require("color") | ||
var helpers = require("postcss-message-helpers") | ||
var postcss = require("postcss") | ||
var color = require("color")("rebeccapurple").rgbString() | ||
@@ -10,25 +10,12 @@ /** | ||
*/ | ||
module.exports = function plugin() { | ||
module.exports = postcss.plugin("postcss-color-rebeccapurple", function() { | ||
return function(style) { | ||
style.eachDecl(function transformDecl(decl) { | ||
if (!decl.value || decl.value.indexOf("rebeccapurple") === -1) { | ||
return | ||
style.eachDecl(function(decl) { | ||
var value = decl.value; | ||
if (value && value.indexOf("rebeccapurple") !== -1) { | ||
decl.value = value.replace(/(rebeccapurple)\b/gi, color) | ||
} | ||
decl.value = helpers.try(function transformRebeccapurpleValue() { | ||
return transformRebeccapurple(decl.value) | ||
}, decl.source) | ||
}) | ||
} | ||
} | ||
/** | ||
* Transform rebeccapurple color to rgb() | ||
* | ||
* @param {String} string declaration value | ||
* @return {String} converted declaration value to rgba() | ||
*/ | ||
function transformRebeccapurple(string) { | ||
return string.replace(/(rebeccapurple)\b/gi, color("rebeccapurple").rgbString()) | ||
} | ||
}) |
{ | ||
"name": "postcss-color-rebeccapurple", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "PostCSS plugin to transform W3C CSS rebeccapurple color to more compatible CSS (rgb())", | ||
@@ -8,3 +8,3 @@ "keywords": [ | ||
"postcss", | ||
"postcss-plugins", | ||
"postcss-plugin", | ||
"color", | ||
@@ -27,4 +27,4 @@ "colour", | ||
"dependencies": { | ||
"color": "^0.7.1", | ||
"postcss-message-helpers": "^1.1.0" | ||
"color": "^0.9.0", | ||
"postcss": "^4.1.13" | ||
}, | ||
@@ -34,4 +34,3 @@ "devDependencies": { | ||
"jshint": "^2.5.6", | ||
"postcss": "^3.0.0", | ||
"tape": "^3.0.0" | ||
"tape": "^4.0.0" | ||
}, | ||
@@ -38,0 +37,0 @@ "scripts": { |
# postcss-color-rebeccapurple [![Build Status](https://travis-ci.org/postcss/postcss-color-rebeccapurple.png)](https://travis-ci.org/postcss/postcss-color-rebeccapurple) | ||
> [PostCSS](https://github.com/postcss/postcss) plugin to transform [W3C CSS `rebeccapurple` color](http://dev.w3.org/csswg/css-color/#valuedef-color-rebeccapurple) to more compatible CSS (rgb()). | ||
> [PostCSS](https://github.com/postcss/postcss) plugin to transform [W3C CSS `rebeccapurple` color](http://dev.w3.org/csswg/css-color/#valdef-color-rebeccapurple) to more compatible CSS (rgb()). | ||
## Why this plugin ? | ||
If you did some CSS, I'm sure you know who [Eric Meyer](https://en.wikipedia.org/wiki/Eric_A._Meyer) is, & what he did for this language. | ||
If you did some CSS, I'm sure you know who [Eric Meyer](https://en.wikipedia.org/wiki/Eric_A._Meyer) is, & what he did for this language. | ||
In memory of [Eric Meyer’s daughter](http://meyerweb.com/eric/thoughts/2014/06/09/in-memoriam-2/), [W3C added new color rebeccapurple to CSS 4 Color Module](http://lists.w3.org/Archives/Public/www-style/2014Jun/0312.html). | ||
@@ -9,0 +9,0 @@ |
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
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
3
4251
18
+ Addedpostcss@^4.1.13
+ Addedamdefine@1.0.1(transitive)
+ Addedcolor@0.9.0(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedcolor-string@0.3.0(transitive)
+ Addedes6-promise@2.3.0(transitive)
+ Addedjs-base64@2.1.9(transitive)
+ Addedpostcss@4.1.16(transitive)
+ Addedsource-map@0.4.4(transitive)
- Removedpostcss-message-helpers@^1.1.0
- Removedcolor@0.7.3(transitive)
- Removedcolor-name@1.0.1(transitive)
- Removedcolor-string@0.2.4(transitive)
- Removedpostcss-message-helpers@1.1.1(transitive)
Updatedcolor@^0.9.0