Detalhes do pacote

postcss-short-size

jonathantneal51.9kCC0-1.04.0.0

Use this in CSS

postcss, css, postcss-plugin, size

readme (leia-me)

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

changelog (log de mudanças)

Changes to PostCSS Short Size

4.0.0 (October 9, 2018)

  • Added: Support for Node 6
  • Added: Support for PostCSS 7

3.0.0 (May 25, 2017)

  • Added: Support for PostCSS 6, Node 4
  • Removed: echint and jscs devDependencies
  • Updated: 2 spaces in Markdown
  • Updated: dependencies

2.0.1 (December 8, 2016)

  • Updated: Use destructing assignment on plugin options
  • Updated: Use template literals

2.0.0 (December 6, 2016)

  • Added: Define skip token
  • Updated: boilerplate conventions (Node v6.9.1 LTS)

1.1.0 (March 5, 2015)

  • Added: Support for aspect-ratio as partial value
  • Updated: Tests

1.0.0 (September 21, 2015)

  • Added: Initial version