mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 21:52:19 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
57
web/node_modules/postcss-discard-overridden/dist/index.js
generated
vendored
Normal file
57
web/node_modules/postcss-discard-overridden/dist/index.js
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _postcss = require('postcss');
|
||||
|
||||
var _postcss2 = _interopRequireDefault(_postcss);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const OVERRIDABLE_RULES = ['keyframes', 'counter-style'];
|
||||
const SCOPE_RULES = ['media', 'supports'];
|
||||
|
||||
function isOverridable(name) {
|
||||
return ~OVERRIDABLE_RULES.indexOf(_postcss2.default.vendor.unprefixed(name.toLowerCase()));
|
||||
}
|
||||
|
||||
function isScope(name) {
|
||||
return ~SCOPE_RULES.indexOf(_postcss2.default.vendor.unprefixed(name.toLowerCase()));
|
||||
}
|
||||
|
||||
function getScope(node) {
|
||||
let current = node.parent;
|
||||
const chain = [node.name.toLowerCase(), node.params];
|
||||
do {
|
||||
if (current.type === 'atrule' && isScope(current.name)) {
|
||||
chain.unshift(current.name + ' ' + current.params);
|
||||
}
|
||||
current = current.parent;
|
||||
} while (current);
|
||||
return chain.join('|');
|
||||
}
|
||||
|
||||
exports.default = _postcss2.default.plugin('postcss-discard-overridden', () => {
|
||||
return css => {
|
||||
const cache = {};
|
||||
const rules = [];
|
||||
css.walkAtRules(node => {
|
||||
if (isOverridable(node.name)) {
|
||||
const scope = getScope(node);
|
||||
cache[scope] = node;
|
||||
rules.push({
|
||||
node,
|
||||
scope
|
||||
});
|
||||
}
|
||||
});
|
||||
rules.forEach(rule => {
|
||||
if (cache[rule.scope] !== rule.node) {
|
||||
rule.node.remove();
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
module.exports = exports['default'];
|
Loading…
Add table
Add a link
Reference in a new issue