Plugin for reduce-css to pack postcss modules.
See files in the example directory.
varpostcss=require('reduce-css-postcss')vargulp=require('gulp')vardel=require('del')varreduce=require('reduce-css')varpath=require('path')varfixtures=path.resolve.bind(path)gulp.task('clean',function(){returndel('build')})gulp.task('single',['clean'],function(){returnreduce.on('error',console.log.bind(console)).on('log',console.log.bind(console)).on('instance',function(b){b.plugin(postcss)}).src('*.css',{basedir: fixtures('src'),bundleOptions: 'common.css',}).pipe(reduce.dest('build',null,{maxSize: 0,assetOutFolder: fixtures('build','images'),}))})gulp.task('watch-single',['clean'],function(){reduce.watch().on('done',function(){console.log('New bundles created!')}).on('error',console.log.bind(console)).on('log',console.log.bind(console)).on('instance',function(b){b.plugin(postcss)}).src('*.css',{basedir: fixtures('src'),bundleOptions: 'common.css',}).pipe(reduce.dest,'build',null,{maxSize: 0,assetOutFolder: fixtures('build','images'),})})gulp.task('multi',['clean'],function(){returnreduce.on('error',console.log.bind(console)).on('log',console.log.bind(console)).on('instance',function(b){b.plugin(postcss)}).src('*.css',{basedir: fixtures('src'),bundleOptions: {groups: '**/+(a|b).css',common: 'common.css',},}).pipe(reduce.dest('build',null,{maxSize: 0,useHash: true,assetOutFolder: fixtures('build','images'),}))})gulp.task('watch-multi',['clean'],function(){reduce.watch().on('done',function(){console.log('New bundles created!')}).on('error',console.log.bind(console)).on('log',console.log.bind(console)).on('instance',function(b){b.plugin(postcss)}).src('*.css',{basedir: fixtures('src'),bundleOptions: {groups: '**/+(a|b).css',common: 'common.css',},}).pipe(reduce.dest,'build',null,{maxSize: 0,useHash: true,assetOutFolder: fixtures('build','images'),})})Type: Function
Receive a pipeline instance, through which you can add, remove, or customize postcss plugins to apply.
Type: Array
Specify extra postcss plugins to apply.