postcss-nested-props
PostCSS plugin to unwrap nested properties.
Nested Properties
CSS has quite a few properties that are in “namespaces;” for instance, font-family
, font-size
, and font-weight
are all in the font
namespace. In CSS, if you want to set a bunch of properties in the same namespace, you have to type it out each time. This plugin provides a shortcut: just write the namespace once, then nest each of the sub-properties within it. For example:
.funky
is compiled to:
.funky
The property namespace itself can also have a value. For example:
.funky }
is compiled to:
For nested rules, use the postcss-nested
plugin, but make sure to run it after this one.
Installation
$ npm install postcss-nested-props
Usage
JavaScript
;
TypeScript
; postcss;
Options
None at this time.
Testing
Run the following command:
$ npm test
This will build scripts, run tests and generate a code coverage report. Anything less than 100% coverage will throw an error.
Watching
For much faster development cycles, run the following commands in 2 separate processes:
$ npm run build:watch
Compiles TypeScript source into the ./dist
folder and watches for changes.
$ npm run watch
Runs the tests in the ./dist
folder and watches for changes.