index.cjs.js 814 B

1234567891011121314151617181920212223242526
  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 gapPropertyRegExp = /^(column-gap|gap|row-gap)$/i;
  5. var index = postcss.plugin('postcss-gap-properties', opts => {
  6. const preserve = 'preserve' in Object(opts) ? Boolean(opts.preserve) : true;
  7. return root => {
  8. // for each shorthand gap, column-gap, or row-gap declaration
  9. root.walkDecls(gapPropertyRegExp, decl => {
  10. // insert a grid-* fallback declaration
  11. decl.cloneBefore({
  12. prop: `grid-${decl.prop}`
  13. }); // conditionally remove the original declaration
  14. if (!preserve) {
  15. decl.remove();
  16. }
  17. });
  18. };
  19. });
  20. module.exports = index;
  21. //# sourceMappingURL=index.cjs.js.map