summaryrefslogtreecommitdiff
path: root/node_modules/postcss-unrgba/index.js
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2023-10-31 15:37:35 +0800
committerlittleblack111 <littleblack11111@gmail.com>2023-10-31 15:37:35 +0800
commitd5f14083061f2ce6a42313188443a42e30796320 (patch)
treecc6a9889e08b29595a76a33b9e7b4ef84866468b /node_modules/postcss-unrgba/index.js
parentb1a6ea021f29f182b62f9f81024a3d8ac8621b7f (diff)
added make browserlist(autoprefixer) work fixed
Diffstat (limited to 'node_modules/postcss-unrgba/index.js')
-rw-r--r--node_modules/postcss-unrgba/index.js59
1 files changed, 0 insertions, 59 deletions
diff --git a/node_modules/postcss-unrgba/index.js b/node_modules/postcss-unrgba/index.js
deleted file mode 100644
index db5d67b1..00000000
--- a/node_modules/postcss-unrgba/index.js
+++ /dev/null
@@ -1,59 +0,0 @@
-var parser = require('postcss-value-parser');
-var postcss = require('postcss');
-
-module.exports = postcss.plugin('postcss-color-rgba-fallback', function (opts) {
- var method = opts && /^(clone|warn)$/i.test(opts.method) ? opts.method.toLowerCase() : 'replace';
- var props = opts && 'properties' in opts ? opts.properties : ['background', 'background-color', 'color', 'border', 'border-bottom', 'border-bottom-color', 'border-color', 'border-left', 'border-left-color', 'border-right', 'border-right-color', 'border-top', 'border-top-color', 'outline', 'outline-color'];
- var filter = opts && opts.filter;
-
- return function (css, result) {
- css.walkRules(function (rule) {
- var decls = {};
-
- rule.nodes.forEach(function (decl) {
- if (decl.prop in decls) decls[decl.prop] = false;
- else decls[decl.prop] = (!props || ~props.indexOf(decl.prop)) && /\brgba\b/i.test(decl.value) ? decl : false;
- });
-
- Object.keys(decls).forEach(function (name) {
- var decl = decls[name];
-
- if (!decl) return;
-
- var isbg = /^background/i.test(decl.prop);
- var isbf = isbg && filter;
-
- var value = parser(decl.value).walk(function (node) {
- if (node.type === 'function' && node.value === 'rgba') {
- if (method === 'warn') return result.warn('rgba() detected', { node: decl });
-
- var rgba = [node.nodes[0], node.nodes[2], node.nodes[4], node.nodes[6]].map(function (word, index) {
- return (0 + Math.round(word.value * (index === 3 ? 255 : 1)).toString(16)).slice(-2);
- });
-
- var argb = rgba.slice(-1).concat(rgba.slice(0, -1)).join('');
-
- var hex = rgba[3] === '00' ? 'transparent' : '#' + rgba.slice(0, 3).join('');
-
- var word = isbf ? 'progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=\'#' + argb + '\',endColorstr=\'#' + argb + '\')' : hex;
-
- node.value = word;
- node.type = 'word';
-
- if (isbf) {
- decl.value = parser.stringify(node);
- node.value = hex;
- }
- }
- }).toString();
-
- if (method !== 'warn' && value !== decl.value) {
- if (method === 'clone' || isbf) decl.cloneBefore({ value: value });
- else decl.value = value;
-
- if (isbf) decl.prop = 'filter';
- }
- });
- });
- };
-});