You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1018 B

4 years ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _postcss = require("postcss");
  7. var _transform = _interopRequireDefault(require("./lib/transform"));
  8. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9. var _default = (0, _postcss.plugin)('postcss-calc', function (opts) {
  10. var options = Object.assign({
  11. precision: 5,
  12. preserve: false,
  13. warnWhenCannotResolve: false,
  14. mediaQueries: false,
  15. selectors: false
  16. }, opts);
  17. return function (css, result) {
  18. css.walk(function (node) {
  19. var type = node.type;
  20. if (type === 'decl') (0, _transform.default)(node, "value", options, result);
  21. if (type === 'atrule' && options.mediaQueries) (0, _transform.default)(node, "params", options, result);
  22. if (type === 'rule' && options.selectors) (0, _transform.default)(node, "selector", options, result);
  23. });
  24. };
  25. });
  26. exports.default = _default;
  27. module.exports = exports.default;