Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 737 Bytes

File metadata and controls

35 lines (26 loc) · 737 Bytes

postcss-import-object

A PostCSS plugin that injects a JavaScript object as CSS custom properties into the :root selector.

This makes it possible to manage variables with JavaScript when using CSS Variables.

Installation

npm install postcss-import-object --save-dev

Usage

import postcss from 'postcss'
import importObject from 'postcss-import-object'

postcss([importObject({
    '--foo': 'bar',
    '--baz': 'foobar'
})])
    .process(input, { from: undefined })
    .then(result => {
        // The argument object is injected into :root.
        // :root {
        //     --foo: bar;
        //     --baz: foobar;
        // }
    })

License

MIT