postcss-short-border-radius
v3.0.0
Published
Use more border-radius properties in CSS
Downloads
11,562
Readme
PostCSS Short Border Radius
PostCSS Short Border Radius lets you use border-top-radius
,
border-right-radius
, border-bottom-radius
, and border-left-radius
properties in CSS, following the 1-to-2 syntax.
.example-1 {
border-top-radius: 10px;
}
.example-2 {
border-top-radius: 10px 5px;
}
/* becomes */
.example-1 {
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.example-2 {
border-top-left-radius: 10px;
border-top-right-radius: 5px;
}
Usage
Add PostCSS Short Border Radius to your project:
npm install postcss-short-border-radius --save-dev
Use PostCSS Short Border Radius to process your CSS:
const postcssShortBorderRadius = require('postcss-short-border-radius');
postcssShortBorderRadius.process(YOUR_CSS /*, processOptions, pluginOptions */);
Or use it as a PostCSS plugin:
const postcss = require('postcss');
const postcssShortBorderRadius = require('postcss-short-border-radius');
postcss([
postcssShortBorderRadius(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);
PostCSS Short Border Radius 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-top-radius
.
postcssShortBorderRadius({ prefix: 'x' });
.example-1 {
-x-border-top-radius: 10px;
}
/* becomes */
.example-1 {
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
skip
The skip
option defines the skip token used to ignore portions of the
shorthand.
postcssShortBorderRadius({ skip: '-' });
.example-1 {
-x-border-top-radius: - 10px;
}
/* becomes */
.example-1 {
border-top-right-radius: 10px;
}