postcss.mjs 721 B

1234567891011121314151617181920212223242526
  1. import postcss from 'postcss';
  2. const selectorRegExp = /:blank([^\w-]|$)/gi;
  3. var postcss$1 = postcss.plugin('css-blank-pseudo', opts => {
  4. const replaceWith = String(Object(opts).replaceWith || '[blank]');
  5. const preserve = Boolean('preserve' in Object(opts) ? opts.preserve : true);
  6. return root => {
  7. root.walkRules(selectorRegExp, rule => {
  8. const selector = rule.selector.replace(selectorRegExp, ($0, $1) => {
  9. return `${replaceWith}${$1}`;
  10. });
  11. const clone = rule.clone({
  12. selector
  13. });
  14. if (preserve) {
  15. rule.before(clone);
  16. } else {
  17. rule.replaceWith(clone);
  18. }
  19. });
  20. };
  21. });
  22. export default postcss$1;
  23. //# sourceMappingURL=postcss.mjs.map