postscss
v2.0.0
Published
node-sass + postcss = postscss
Downloads
725
Readme
PostScss
node-sass + PostCss = PostScss.
PostScss compiles SASS into CSS then runs PostCSS plugins. It also supports importing Eyeglass modules.
Install
npm i postscss
Usage
var postscss = require('postscss');
// Single build
postscss([postcss plugins]).process({
from: 'xxx/src/scss/xxx.scss',
to: 'xxx/dist/css/xxx.css'
});
// Disabling source maps
postscss([postcss plugins]).process({
from: 'xxx/src/scss/xxx.scss',
to: 'xxx/dist/css/xxx.css',
sourceMapDisabled: true
});
// Multiple builds
postscss([postcss plugins]).processMany([{
from: 'xxx/src/scss/xxx.scss',
to: 'xxx/dist/css/xxx.css'
}, {
from: 'xxx/src/scss/xxx2.scss',
to: 'xxx/dist/css/xxx2.css'
}]);
Promises
var postscss = require('postscss');
postscss([postcss plugins]).process({
from: 'xxx/src/scss/xxx.scss',
to: 'xxx/dist/css/xxx.css'
})
.then(function() {
console.log('All done.');
})
.catch(function(error) {
// Error handling.
});
PostCss plugins example
var postscss = require('postscss');
var autoprefixer = require('autoprefixer');
var cssnano = require('cssnano');
postscss([autoprefixer(['> 5%', 'last 2 versions', 'ie > 7']), cssnano()]).process({
from: 'xxx/src/scss/xxx.scss',
to: 'xxx/dist/css/xxx.css'
});
Grunt example
grunt.registerTask('compileSCSS', 'Task description.', function () {
var done = this.async();
var postscss = require('postscss');
postscss([postcss plugins]).process({
from: 'xxx/src/scss/xxx.scss',
to: 'xxx/dist/css/xxx.css'
})
.then(done);
});
SASS importer
var postscss = require('postscss');
var npmsass = require('npm-sass');
postscss([postcss plugins]).process({
from: 'xxx/src/scss/xxx.scss',
to: 'xxx/dist/css/xxx.css',
importer: npmsass.importer
});