Last change
on this file since 59329aa was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | "use strict";
|
---|
2 |
|
---|
3 | Object.defineProperty(exports, "__esModule", {
|
---|
4 | value: true
|
---|
5 | });
|
---|
6 | exports.default = void 0;
|
---|
7 |
|
---|
8 | var _transform = _interopRequireDefault(require("./lib/transform"));
|
---|
9 |
|
---|
10 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
---|
11 |
|
---|
12 | function pluginCreator(opts) {
|
---|
13 | const options = Object.assign({
|
---|
14 | precision: 5,
|
---|
15 | preserve: false,
|
---|
16 | warnWhenCannotResolve: false,
|
---|
17 | mediaQueries: false,
|
---|
18 | selectors: false
|
---|
19 | }, opts);
|
---|
20 | return {
|
---|
21 | postcssPlugin: 'postcss-calc',
|
---|
22 |
|
---|
23 | OnceExit(css, {
|
---|
24 | result
|
---|
25 | }) {
|
---|
26 | css.walk(node => {
|
---|
27 | const {
|
---|
28 | type
|
---|
29 | } = node;
|
---|
30 |
|
---|
31 | if (type === 'decl') {
|
---|
32 | (0, _transform.default)(node, "value", options, result);
|
---|
33 | }
|
---|
34 |
|
---|
35 | if (type === 'atrule' && options.mediaQueries) {
|
---|
36 | (0, _transform.default)(node, "params", options, result);
|
---|
37 | }
|
---|
38 |
|
---|
39 | if (type === 'rule' && options.selectors) {
|
---|
40 | (0, _transform.default)(node, "selector", options, result);
|
---|
41 | }
|
---|
42 | });
|
---|
43 | }
|
---|
44 |
|
---|
45 | };
|
---|
46 | }
|
---|
47 |
|
---|
48 | pluginCreator.postcss = true;
|
---|
49 | var _default = pluginCreator;
|
---|
50 | exports.default = _default;
|
---|
51 | module.exports = exports.default; |
---|
Note:
See
TracBrowser
for help on using the repository browser.