postcss-short-border-radius

3.0.0 • Public • Published

PostCSS Short Border Radius PostCSS

NPM Version Build Status Support Chat

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

Package Sidebar

Install

npm i postcss-short-border-radius

Weekly Downloads

2,658

Version

3.0.0

License

CC0-1.0

Unpacked Size

21.6 kB

Total Files

8

Last publish

Collaborators

  • romainmenke
  • alaguna
  • jonathantneal