postcss-gap-properties
TypeScript icon, indicating that this package has built-in type declarations

6.0.0 • Public • Published

PostCSS Gap Properties PostCSS Logo

npm install postcss-gap-properties --save-dev

PostCSS Gap Properties lets you use the gap, column-gap, and row-gap shorthand properties in CSS, following the CSS Grid Layout specification.

.standard-grid {
	display: grid;
	gap: 20px;
}

.spaced-grid {
	display: grid;
	column-gap: 40px;
	row-gap: 20px;
}

/* becomes */

.standard-grid {
	display: grid;
	grid-gap: 20px;
	gap: 20px;
}

.spaced-grid {
	display: grid;
	grid-column-gap: 40px;
	column-gap: 40px;
	grid-row-gap: 20px;
	row-gap: 20px;
}

Usage

Add PostCSS Gap Properties to your project:

npm install postcss postcss-gap-properties --save-dev

Use it as a PostCSS plugin:

const postcss = require('postcss');
const postcssGapProperties = require('postcss-gap-properties');

postcss([
	postcssGapProperties(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);

Options

preserve

The preserve option determines whether the original notation is preserved. By default, it is preserved.

postcssGapProperties({ preserve: false })
.standard-grid {
	display: grid;
	gap: 20px;
}

.spaced-grid {
	display: grid;
	column-gap: 40px;
	row-gap: 20px;
}

/* becomes */

.standard-grid {
	display: grid;
	grid-gap: 20px;
}

.spaced-grid {
	display: grid;
	grid-column-gap: 40px;
	grid-row-gap: 20px;
}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
6.0.0742,801latest

Version History

VersionDownloads (Last 7 Days)Published
6.0.0742,801
5.0.1371,408
5.0.073,759
4.0.1163,248
4.0.0766
3.0.52,485,463
3.0.42,640
3.0.3164,125
3.0.246,839
3.0.18,673
3.0.02,497
2.0.01,158,606
1.0.06,119

Package Sidebar

Install

npm i postcss-gap-properties

Weekly Downloads

5,226,944

Version

6.0.0

License

MIT-0

Unpacked Size

5.99 kB

Total Files

7

Last publish

Collaborators

  • romainmenke
  • alaguna
  • jonathantneal