postcss-short-size
Write shorthand size properties in CSS
Last updated 8 years ago by jonathantneal .
CC0-1.0 · Repository · Bugs · Original npm · Tarball · package.json
$ npm install postcss-short-size 
SYNC missed versions from official npm registry.

PostCSS Short Size PostCSS

NPM Version Build Status Support Chat

PostCSS Short Size lets you use size properties to represent width and height in CSS, following the 1-to-2 syntax.

.image {
  size: 100px;
}

.video {
  max-size: 400px 300px;
}

/* becomes */

.image {
  width: 100px;
  height: 100px;
}

.video {
  max-width: 400px;
  max-height: 300px;
}

The supported properties are size, min-size, and max-size.

Usage

Add PostCSS Short Size to your project:

npm install postcss-short-size --save-dev

Use PostCSS Short Size to process your CSS:

const postcssShortSize = require('postcss-short-size');

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

Or use it as a PostCSS plugin:

const postcss = require('postcss');
const postcssShortSize = require('postcss-short-size');

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

PostCSS Short Size 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-margin.

postcssShortSize({ prefix: 'x' });
.image {
  x-size: 100px;
}

/* becomes */

.image {
  width: 100px;
  height: 100px;
}

skip

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

postcssShortSize({ skip: '-' });
.image {
  size: - 100px;
}

/* becomes */

.image {
  height: 100px;
}

Current Tags

  • 4.0.0                                ...           latest (6 years ago)

6 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.1.0                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (7)
Dependents (2)

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