postcss-gap-properties
Version:
Use the gap, column-gap, and row-gap shorthand properties in CSS
2 lines (1 loc) • 526 B
JavaScript
;const e=["column-gap","gap","row-gap"],creator=o=>{const r=Object.assign({preserve:!0},o);return{postcssPlugin:"postcss-gap-properties",Declaration(o){if(!e.includes(o.prop.toLowerCase()))return;if(!o.parent?.some((e=>"decl"===e.type&&("display"===e.prop.toLowerCase()&&"grid"===e.value.toLowerCase()))))return;const s=`grid-${o.prop.toLowerCase()}`,p=o.parent?.some((e=>"decl"===e.type&&e.prop.toLowerCase()===s));p||(o.cloneBefore({prop:s}),r.preserve||o.remove())}}};creator.postcss=!0,module.exports=creator;