Using PostCSS Plugins With SASS

I really like PostCSS plugins such as Autoprefixer and CSSNano but I found them awkward to integrate because I use SASS.

I decided to create PostSCSS to simplify using SASS with PostCSS. PostSCSS compiles SASS into CSS then runs PostCSS plugins; basically PostSCSS = node-sass + PostCSS.

Here is a simple example:

var postscss = require('postscss');
var autoprefixer = require('autoprefixer');
var cssnano = require('cssnano');

postscss([autoprefixer(['> 5%', 'last 2 versions']), cssnano()]).process({
    from: 'xxx/src/scss/xxx.scss',
    to: 'xxx/dist/css/xxx.css'
});

More examples can be found at github.com/nicbell/postscss.