postcss-short-color

2018-10-23 admin

postcss-short-color是什么

什么是postcss-short-color,Define background-color within the color property in CSS

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

PostCSS Short Color PostCSS

NPM Version Build Status PostCSS Short Color iis7站长之家

PostCSS Short Color lets you define background-color within the color property in CSS.

header {
  color: #abccfc #212231;
}
/* becomes */
header {
  background-color: #212231;
  color: #abccfc;
}

Usage

Add PostCSS Short Color to your project:

npm install postcss-short-color --save-dev

Use PostCSS Short Color to process your CSS:

const postcssShortColor = require('postcss-short-color');
postcssShortColor.process(YOUR_CSS /*, processOptions, pluginOptions */);

Or use it as a PostCSS plugin:

const postcss = require('postcss');
const postcssShortColor = require('postcss-short-color');
postcss([
  postcssShortColor(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);

PostCSS Short Color 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-color.

postcssShortColor({ prefix: 'x' });
header {
  -x-color: #abccfc #212231;
}
/* becomes */
header {
  background-color: #212231;
  color: #abccfc;
}

skip

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

postcssShortColor({ skip: '-' });
header {
  color: - #212231;
}
/* becomes */
header {
  background-color: #212231;
}

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

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

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

文章标题:postcss-short-color

回到顶部