source: trip-planner-front/node_modules/postcss-discard-empty/dist/index.js@ 6c1585f

Last change on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 947 bytes
RevLine 
[6a3a178]1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = void 0;
7const plugin = 'postcss-discard-empty';
8
9function discardAndReport(css, result) {
10 function discardEmpty(node) {
11 const {
12 type,
13 nodes: sub,
14 params
15 } = node;
16
17 if (sub) {
18 node.each(discardEmpty);
19 }
20
21 if (type === 'decl' && !node.value || type === 'rule' && !node.selector || sub && !sub.length || type === 'atrule' && (!sub && !params || !params && !sub.length)) {
22 node.remove();
23 result.messages.push({
24 type: 'removal',
25 plugin,
26 node
27 });
28 }
29 }
30
31 css.each(discardEmpty);
32}
33
34function pluginCreator() {
35 return {
36 postcssPlugin: plugin,
37
38 OnceExit(css, {
39 result
40 }) {
41 discardAndReport(css, result);
42 }
43
44 };
45}
46
47pluginCreator.postcss = true;
48var _default = pluginCreator;
49exports.default = _default;
50module.exports = exports.default;
Note: See TracBrowser for help on using the repository browser.