postcss.js 873 B

123456789101112131415161718192021222324252627282930
  1. 'use strict';
  2. function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
  3. var postcss = _interopDefault(require('postcss'));
  4. const selectorRegExp = /:blank([^\w-]|$)/gi;
  5. var postcss$1 = postcss.plugin('css-blank-pseudo', opts => {
  6. const replaceWith = String(Object(opts).replaceWith || '[blank]');
  7. const preserve = Boolean('preserve' in Object(opts) ? opts.preserve : true);
  8. return root => {
  9. root.walkRules(selectorRegExp, rule => {
  10. const selector = rule.selector.replace(selectorRegExp, ($0, $1) => {
  11. return `${replaceWith}${$1}`;
  12. });
  13. const clone = rule.clone({
  14. selector
  15. });
  16. if (preserve) {
  17. rule.before(clone);
  18. } else {
  19. rule.replaceWith(clone);
  20. }
  21. });
  22. };
  23. });
  24. module.exports = postcss$1;
  25. //# sourceMappingURL=postcss.js.map