postcss-short-border
Define multiple edges, styles, and colors inside the border property in CSS
Last updated 7 years ago by jonathantneal .
CC0-1.0 · Repository · Bugs · Original npm · Tarball · package.json
$ npm install postcss-short-border 
SYNC missed versions from official npm registry.

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

Current Tags

  • 4.0.0                                ...           latest (6 years ago)

5 Versions

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

© 2010 - cnpmjs.org x YWFE | Home | YWFE