PostCSS plugin that transforms px values to rem, using a pr unit
JavaScript
Latest commit bd45a6d Jan 10, 2017 @jameskolce v1.1.0
Permalink
Failed to load latest commit information.
lib performance workaround (#7) Jan 8, 2017
test
.babelrc
.gitignore
.npmignore
.travis.yml Initial commit Jun 19, 2016
LICENSE
README.md
package.json v1.1.0 Jan 9, 2017

README.md

postcss-pr Build Status

PostCSS plugin that defines a pr unit that transforms a value in px to output its equivalent in rem.

Write this:

:root {
  font: 16px / 1.5 "Helvetica", "Arial", sans-serif;
}

section {
  margin-bottom: 24pr;
  padding-top: 32pr;
}

And get this:

:root {
  font: 16px / 1.5 "Helvetica", "Arial", sans-serif;
}

section {
  margin-bottom: 1.5rem;
  padding-top: 2rem;
}

Installation

$ npm install postcss-pr

Usage

postcss([ require('postcss-pr') ])

See PostCSS docs for examples for your environment.

Options

rootSelector

  • Type: string
  • Default: :root

The selector where the font-size is set.

unit

  • Type: string
  • Default: pr

The unit to be used in your CSS.

fontSize

  • Type: number
  • Default: 16

The default root font size. Used only when a font size definition in the root element is not found.

License

MIT - James Kolce