Detalhes do pacote

postcss-short-border

jonathantneal37.6kCC0-1.04.0.0

Define multiple edges, styles, and colors inside the border property in CSS

postcss, css, postcss-plugin, border

readme (leia-me)

PostCSS Short Border PostCSS

NPM Version Build Status Support Chat

PostCSS Short Border lets you omit sides within border- properties in CSS. It also lets you fully define individual values on the border property using dividers (/).

.example-1 {
  border-color: blue blue *;
}

.example-2 {
  border-width: 1px *;
}

.example-3 {
  border: 1px 2px / solid / red orange;
}

/* becomes */

.example-1 {
  border-top-color: blue;
  border-right-color: blue;
  border-left-color: blue;
}

.example-2 {
  border-top-width: 1px;
  border-bottom-width: 1px;
}

.example-3 {
  border-width: 1px 2px;
  border-style: solid;
  border-color: red orange;
}

Usage

Add PostCSS Short Border to your project:

npm install postcss-short-border --save-dev

Use PostCSS Short Border to process your CSS:

const postcssShortBorder = require('postcss-short-border');

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

Or use it as a PostCSS plugin:

const postcss = require('postcss');
const postcssShortBorder = require('postcss-short-border');

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

PostCSS Short Border 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-border.

postcssShortBorder({ prefix: 'x' });
.example-1 {
  -x-border-color: blue blue *;
}

/* becomes */

.example-1 {
  border-top-color: blue;
  border-right-color: blue;
  border-left-color: blue;
}

skip

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

postcssShortBorder({ skip: '-' });
.example-1 {
  border-color: blue blue -;
}

/* becomes */

.example-1 {
  border-top-color: blue;
  border-right-color: blue;
  border-left-color: blue;
}

changelog (log de mudanças)

Changes to PostCSS Short Border

4.0.0 (October 10, 2018)

  • Added: Support for PostCSS 7, Node 6

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 30, 2016)

  • Added: Initial release