gulp-postcss: Unable to use cssnext as a processor with gulp-postcss

I’d like to use the cssnext plugin pack with gulp-postcss, as my first processor to be followed by a set of other cherry picked postcss plugins. The trouble is that I can’t figure out how to get cssnext working with gulp-postcss. In the following code snippet I think I’m using cssnext() wrong within the processors array, but everything I’ve tried to correct it fails.

var gulp = require('gulp');
var postcss = require('gulp-postcss');
var cssnext = require('cssnext');

config = {
  cssDistPath: './dist/css',
  cssSrcGlob:  './src/css/**/*.css'
};

gulp.task('css', function () {

  var processors = [
    cssnext({
      features: {
        calc: {
            preserve: true
        }
      }
    })
  ];

  return gulp.src(config.cssSrcGlob)
    .pipe(postcss(processors))
    .pipe(gulp.dest(config.cssDistPath));

});

Do you have any suggestions on how to get this working, or a better configuration?

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 23 (14 by maintainers)

Commits related to this issue

Most upvoted comments

I will take a look at this tonight

On 08 Apr 2015, at 18:09, Andrey Sitnik notifications@github.com wrote:

@w0rm can I left it on you? I need to prepare to tomorrow flight

— Reply to this email directly or view it on GitHub.