postcss-short-spacing
Use this in CSS
Last updated 8 years ago by jonathantneal .
CC0-1.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install postcss-short-spacing 
SYNC missed versions from official npm registry.

PostCSS Short Spacing PostCSS

NPM Version Build Status Support Chat

PostCSS Short Spacing lets you omit sides within margin and padding properties in CSS.

section {
  margin: 1em *;
}

/* becomes */

section {
  margin-top: 1em;
  margin-bottom: 1em;
}

Supported properties include margin, margin-block, margin-inline, margin-start, margin-end, padding, padding-block, padding-inline, padding-start, and padding-end.

Usage

Add PostCSS Short Spacing to your project:

npm install postcss-short-spacing --save-dev

Use PostCSS Short Spacing to process your CSS:

const postcssShortSpacing = require('postcss-short-spacing');

postcssShortSpacing.process(YOUR_CSS /*, processOptions, pluginOptions */);

Or use it as a PostCSS plugin:

const postcss = require('postcss');
const postcssShortSpacing = require('postcss-short-spacing');

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

PostCSS Short Spacing runs in all Node environments, with special instructions for:

Node PostCSS CLI Webpack Create React App Gulp Grunt

Options

prefix

The prefix option defines a prefix required by properties being transformed. Wrapping dashes are automatically applied, so that x would transform -x-margin.

postcssShortSpacing({ prefix: 'x' });
body {
  -x-margin: 1em *;
}

/* becomes */

section {
  margin-top: 1em;
  margin-bottom: 1em;
}

skip

The skip option defines the skip token used to ignore portions of the shorthand.

postcssShortSpacing({ skip: '-' });
body {
  -x-margin: 1em -;
}

/* becomes */

section {
  margin-top: 1em;
  margin-bottom: 1em;
}

Current Tags

  • 4.0.0                                ...           latest (8 years ago)

5 Versions

  • 4.0.0                                ...           8 years ago
  • 3.0.0                                ...           9 years ago
  • 2.0.1                                ...           9 years ago
  • 2.0.0                                ...           9 years ago
  • 1.0.0                                ...           11 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 4
Last Day 0
Last Week 4
Last Month 1
Dependencies (1)
Dev Dependencies (10)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |