0.2.0 • Published 8 years ago

postcss-inline-trait v0.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

PostCSS Inline Trait Build Status

PostCSS plugin which allows for inline declaration of CSS properties whose values will be imported from a traits directory..

Converts:

.foo {
    /* .css file-ending is optional */
    /* path is assumed to be ./common/css/traits/fancy.trait */
    trait: superFancy from 'fancy.trait';
}

/* fancy.css */
.superFancy {
    background-color: 'pink';
}

into:

.foo {
  background-color: 'pink';
}

Usage

var inlineTrait = require('postcss-inline-trait');
postcss([inlineTrait({
    getFileText: function(path){
        // return environment-specific means of retrieving text at path such as Node's fs.readFile or SystemJS fetch
        // e.g:
        return System.normalize(path).then(System.import.bind(System));
    }
})])

See PostCSS docs for examples for your environment.