Last change
on this file was e29cc2e, checked in by Ema <ema_spirova@…>, 3 years ago |
primeNG components
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | "use strict";
|
---|
2 |
|
---|
3 | Object.defineProperty(exports, "__esModule", {
|
---|
4 | value: true
|
---|
5 | });
|
---|
6 | exports.default = void 0;
|
---|
7 |
|
---|
8 | var _alphanumSort = _interopRequireDefault(require("alphanum-sort"));
|
---|
9 |
|
---|
10 | var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
|
---|
11 |
|
---|
12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
---|
13 |
|
---|
14 | function parseSelectors(selectors, callback) {
|
---|
15 | return (0, _postcssSelectorParser.default)(callback).processSync(selectors);
|
---|
16 | }
|
---|
17 |
|
---|
18 | function unique(rule) {
|
---|
19 | rule.selector = (0, _alphanumSort.default)([...new Set(rule.selectors)], {
|
---|
20 | insensitive: true
|
---|
21 | }).join();
|
---|
22 | }
|
---|
23 |
|
---|
24 | function pluginCreator() {
|
---|
25 | return {
|
---|
26 | postcssPlugin: 'postcss-unique-selectors',
|
---|
27 |
|
---|
28 | OnceExit(css) {
|
---|
29 | css.walkRules(nodes => {
|
---|
30 | let comments = [];
|
---|
31 | nodes.selector = parseSelectors(nodes.selector, selNode => {
|
---|
32 | selNode.walk(sel => {
|
---|
33 | if (sel.type === 'comment') {
|
---|
34 | comments.push(sel.value);
|
---|
35 | sel.remove();
|
---|
36 | return;
|
---|
37 | } else {
|
---|
38 | return sel;
|
---|
39 | }
|
---|
40 | });
|
---|
41 | });
|
---|
42 | unique(nodes);
|
---|
43 | nodes.selectors = nodes.selectors.concat(comments);
|
---|
44 | });
|
---|
45 | }
|
---|
46 |
|
---|
47 | };
|
---|
48 | }
|
---|
49 |
|
---|
50 | pluginCreator.postcss = true;
|
---|
51 | var _default = pluginCreator;
|
---|
52 | exports.default = _default;
|
---|
53 | module.exports = exports.default; |
---|
Note:
See
TracBrowser
for help on using the repository browser.