index.es.mjs 661 B

12345678910111213141516171819202122
  1. import postcss from 'postcss';
  2. const gapPropertyRegExp = /^(column-gap|gap|row-gap)$/i;
  3. var index = postcss.plugin('postcss-gap-properties', opts => {
  4. const preserve = 'preserve' in Object(opts) ? Boolean(opts.preserve) : true;
  5. return root => {
  6. // for each shorthand gap, column-gap, or row-gap declaration
  7. root.walkDecls(gapPropertyRegExp, decl => {
  8. // insert a grid-* fallback declaration
  9. decl.cloneBefore({
  10. prop: `grid-${decl.prop}`
  11. }); // conditionally remove the original declaration
  12. if (!preserve) {
  13. decl.remove();
  14. }
  15. });
  16. };
  17. });
  18. export default index;
  19. //# sourceMappingURL=index.es.mjs.map