PostCSS plugin for adding modular scale to your styles
JavaScript
Permalink
Failed to load latest commit information.
test Add support for shorthand CSS properties. (#20) Jul 19, 2016
.editorconfig Simplifies plugin. Oct 16, 2015
.eslintrc Simplifies plugin. Oct 16, 2015
.gitignore Adds working modular scale plugin Apr 29, 2015
.npmignore Simplifies plugin. Oct 16, 2015
.travis.yml Simplifies plugin. Oct 16, 2015
ChangeLog.md
LICENSE Adds working modular scale plugin Apr 29, 2015
README.md Updates README Oct 16, 2015
gulpfile.js Removes bad lints Mar 31, 2016
index.js Add support for shorthand CSS properties. (#20) Jul 19, 2016
package.json Add support for shorthand CSS properties. (#20) Jul 19, 2016

README.md

PostCSS Modular Scale

A plugin to provide a modular scale function in your styles.

Install

npm install postcss-modular-scale

Usage

To generate relative values use target / base font size

Example:

1 = 16px ( target ) / 16px ( base font size )
0.75 = 12px ( target ) / 16px ( base font size )
Generates `em` or `rem` relative values

Input

:root {
  --ms-bases: 1, 0.75;
  --ms-ratios: 2;
}

.header {
  font-size: ms(4)rem;
}

Output

:root {
  --ms-bases: 1, 0.75;
  --ms-ratios: 2;
}

.header {
  font-size: 3rem;
}

Mad props

Tons of thanks to Scott Kellum @scottkellum & Tim Brown @nicewebtype for making Modular Scale and the libraries that make this plugin possible.