postcss-short-spacing

2018-10-23 admin

postcss-short-spacing是什么

什么是postcss-short-spacing,Use this in CSS

postcss-short-spacing使用教程帮助文档

PostCSS Short Spacing PostCSS

Gulp iis7站长之家 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;
}

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-43429.html

文章标题:postcss-short-spacing

回到顶部