@csstools/postcss-ic-unit
TypeScript icon, indicating that this package has built-in type declarations

3.0.6 • Public • Published

PostCSS IC Unit PostCSS Logo

npm version Build Status Discord

Baseline Status CSS Standard Status

PostCSS IC Unit lets you use the ic length unit, following the CSS Values and Units Module specification.

p {
  text-indent: 2ic;
}

.bubble {
  width: calc(8ic + 20px);
}

/* becomes */
p {
  text-indent: 2em;
}

.bubble {
  width: calc(8em + 20px);
}

See prior work by JLHwung here postcss-ic-unit To ensure long term maintenance and to provide the needed features this plugin was recreated based on JLHwung's work.

Usage

Add PostCSS IC Unit to your project:

npm install postcss @csstools/postcss-ic-unit --save-dev

Use it as a PostCSS plugin:

const postcss = require('postcss');
const postcssIcUnit = require('@csstools/postcss-ic-unit');

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

PostCSS IC Unit runs in all Node environments, with special instructions for:

Node PostCSS CLI Webpack Gulp Grunt

Options

preserve

The preserve option determines whether the original source is preserved. By default, it is not preserved.

postcssIcUnit({ preserve: true })
p {
  text-indent: 2ic;
}

/* becomes */

p {
  text-indent: 2em;
  text-indent: 2ic;
}

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 3.0.6
    251,510
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 3.0.6
    251,510
  • 3.0.5
    65,355
  • 3.0.4
    61,370
  • 3.0.3
    114,449
  • 3.0.2
    151,663
  • 3.0.1
    21,270
  • 3.0.0
    47,396
  • 2.0.4
    124,365
  • 2.0.3
    6,094
  • 2.0.2
    109,500
  • 2.0.1
    4,004
  • 2.0.0
    2,179
  • 1.0.1
    2,752,264
  • 1.0.0
    246,310

Package Sidebar

Install

npm i @csstools/postcss-ic-unit

Weekly Downloads

3,957,729

Version

3.0.6

License

MIT-0

Unpacked Size

8.5 kB

Total Files

7

Last publish

Collaborators

  • romainmenke
  • alaguna
  • jonathantneal