postcss-color-rebeccapurple
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -1,3 +0,9 @@ | ||
# 3.0.0 - 2016-05-10 | ||
# 3.1.0 - 2018-05-01 | ||
- Improve `rebeccapurple` pre-parse word detection | ||
- Switched from `postcss-value-parser` to `postcss-values-parser` | ||
- Bump `postcss` from `^6.0.1` to `^6.0.22` | ||
# 3.0.0 - 2017-05-10 | ||
- Added: compatibility with postcss v6.x | ||
@@ -4,0 +10,0 @@ |
13
index.js
@@ -5,4 +5,5 @@ /** | ||
const postcss = require("postcss") | ||
const valueParser = require("postcss-value-parser") | ||
const valueParser = require("postcss-values-parser") | ||
const color = "#639" | ||
const regexp = /(^|[^\w-])rebeccapurple([^\w-]|$)/ | ||
@@ -16,10 +17,14 @@ /** | ||
if (value && value.indexOf("rebeccapurple") !== -1) { | ||
decl.value = valueParser(value).walk((node) => { | ||
if (value && regexp.test(value)) { | ||
const ast = valueParser(value).parse() | ||
ast.walk(node => { | ||
if (node.type === "word" && node.value === "rebeccapurple") { | ||
node.value = color | ||
} | ||
}).toString() | ||
}) | ||
decl.value = ast.toString() | ||
} | ||
}) | ||
}) |
{ | ||
"name": "postcss-color-rebeccapurple", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "PostCSS plugin to transform W3C CSS rebeccapurple color to more compatible CSS (rgb())", | ||
@@ -24,10 +24,10 @@ "keywords": [ | ||
"dependencies": { | ||
"postcss": "^6.0.1", | ||
"postcss-value-parser": "^3.3.0" | ||
"postcss": "^6.0.22", | ||
"postcss-values-parser": "^1.5.0" | ||
}, | ||
"devDependencies": { | ||
"jscs": "^3.0.7", | ||
"jshint": "^2.9.4", | ||
"jshint": "^2.9.5", | ||
"npmpub": "^3.1.0", | ||
"tape": "^4.6.3" | ||
"tape": "^4.9.0" | ||
}, | ||
@@ -34,0 +34,0 @@ "scripts": { |
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
5121
24
1
+ Addedpostcss-values-parser@^1.5.0
+ Addedflatten@1.0.3(transitive)
+ Addedindexes-of@1.0.1(transitive)
+ Addedpostcss-values-parser@1.5.0(transitive)
+ Addeduniq@1.0.1(transitive)
- Removedpostcss-value-parser@^3.3.0
- Removedpostcss-value-parser@3.3.1(transitive)
Updatedpostcss@^6.0.22