Détail du package

postcss-short-color

jonathantneal24.5kCC0-1.04.0.0

Define background-color within the color property in CSS

postcss, css, postcss-plugin, color

readme

PostCSS Short Color PostCSS

NPM Version Build Status Support Chat

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;
}

changelog

Changes to PostCSS Short Color

4.0.0 (October 9, 2018)

  • Updated: Supports Node 6+ (major)
  • Updated: PostCSS 7.0.5 (major)

3.0.0 (May 25, 2017)

  • Added: Support for PostCSS 6, Node 4
  • Removed: echint and jscs devDependencies
  • Updated: 2 spaces in Markdown
  • Updated: dependencies

2.0.1 (December 8, 2016)

  • Updated: Use destructing assignment on plugin options
  • Updated: Use template literals

2.0.0 (December 6, 2016)

  • Added: Define skip token
  • Updated: boilerplate conventions (Node v6.9.1 LTS)

1.0.0 (September 29, 2015)

Added: Initial version