PostCSS Short Border
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 = ; postcssShortBorder;
Or use it as a PostCSS plugin:
const postcss = ;const postcssShortBorder = ; ;
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
.
;
.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.
;
.example-1 { border-color: blue blue -;} /* becomes */ .example-1 { border-top-color: blue; border-right-color: blue; border-left-color: blue;}