replaceSymbols.js 875 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _replaceValueSymbols = _interopRequireDefault(require("./replaceValueSymbols.js"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. const replaceSymbols = (css, replacements) => {
  9. css.walk(node => {
  10. if (node.type === "decl" && node.value) {
  11. node.value = (0, _replaceValueSymbols.default)(node.value.toString(), replacements);
  12. } else if (node.type === "rule" && node.selector) {
  13. node.selector = (0, _replaceValueSymbols.default)(node.selector.toString(), replacements);
  14. } else if (node.type === "atrule" && node.params) {
  15. node.params = (0, _replaceValueSymbols.default)(node.params.toString(), replacements);
  16. }
  17. });
  18. };
  19. var _default = replaceSymbols;
  20. exports.default = _default;