postcss-hexrgba
Advanced tools
Comparing version 1.0.2 to 2.0.0
33
index.js
@@ -38,19 +38,20 @@ 'use strict'; | ||
// Get the raw hex values and replace them | ||
let output = input.replace(/rgba\(#(.*?),/g, (match, hex) => { | ||
let rgb = hexRgb(hex), | ||
matchHex = new RegExp('#' + hex); | ||
if (input.includes('rgba(#')) { | ||
// Get the raw hex values and replace them | ||
let output = input.replace(/rgba\(#(.*?),/g, (match, hex) => { | ||
let rgb = hexRgb(hex), | ||
matchHex = new RegExp('#' + hex); | ||
// If conversion fails, emit a warning | ||
if (!rgb) { | ||
result.warn('not a valid hex', { node: decl }); | ||
return match; | ||
} | ||
rgb = rgb.toString(); | ||
// If conversion fails, emit a warning | ||
if (!rgb) { | ||
result.warn('not a valid hex', { node: decl }); | ||
return match; | ||
} | ||
rgb = rgb.toString(); | ||
return match.replace(matchHex, rgb); | ||
}); | ||
decl.value = output; | ||
return match.replace(matchHex, rgb); | ||
}); | ||
decl.value = output; | ||
} | ||
} | ||
@@ -57,0 +58,0 @@ |
{ | ||
"name": "postcss-hexrgba", | ||
"version": "1.0.2", | ||
"version": "2.0.0", | ||
"description": "PostCSS plugin that adds shorthand hex methods to rgba() values", | ||
@@ -13,6 +13,3 @@ "keywords": [ | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/seaneking/postcss-hexrgba.git" | ||
}, | ||
"repository": "seaneking/postcss-hexrgba", | ||
"author": "Sean King <sean@simpla.io>", | ||
@@ -26,13 +23,9 @@ "maintainers": [ | ||
], | ||
"bugs": { | ||
"url": "https://github.com/seaneking/postcss-hexrgba/issues" | ||
}, | ||
"homepage": "https://github.com/seaneking/postcss-hexrgba", | ||
"dependencies": { | ||
"postcss": "^6.0.7" | ||
"postcss": "^7.0.14" | ||
}, | ||
"devDependencies": { | ||
"chai": "^4.0.2", | ||
"eslint": "^4.1.1", | ||
"mocha": "^3.4.2" | ||
"chai": "^4.2.0", | ||
"eslint": "^5.16.0", | ||
"mocha": "^6.1.1" | ||
}, | ||
@@ -39,0 +32,0 @@ "scripts": { |
# PostCSS HexRGBA | ||
[![NPM version][npm-badge]][npm-url] [![Downloads][downloads-badge]][npm-url] [![Build Status][travis-badge]][travis-url] | ||
[PostCSS][PostCSS] plugin that adds shorthand hex methods to rbga() values. | ||
[PostCSS][PostCSS] plugin that adds shorthand hex methods to rgba() values. | ||
@@ -6,0 +6,0 @@ _Part of [Rucksack - CSS Superpowers](http://simplaio.github.io/rucksack)_ |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
7354
5
54
1
1
+ Addedpicocolors@0.2.1(transitive)
+ Addedpostcss@7.0.39(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedpostcss@6.0.23(transitive)
- Removedsupports-color@5.5.0(transitive)
Updatedpostcss@^7.0.14