How to tell Gulp to skip or ignore some files in gulp.src([...])?

laukok picture laukok · Nov 3, 2014 · Viewed 32.8k times · Source

How can I tell Gulp to skip or ignore some files in gulp.src([...])? For instance, I don't want to compress and concat this file in my css/ folder - 'css/ignnore.css'?

var autoprefix = require('gulp-autoprefixer'),
    concat = require('gulp-concat'),
    minifyCss = require('gulp-minify-css');

gulp.task('styles', function() {
  gulp.src([
      'css/ignnore.css', // ignore this file
      'css/*.css'
    ])
    .pipe(concat('styles.css'))
    .pipe(autoprefix('last 2 versions'))
    .pipe(minifyCss())
    .pipe(gulp.dest('local/view/style/base/css/dist/'));
});

Answer

jdlm picture jdlm · Nov 3, 2014

Add a !:

gulp.task('styles', function() {
  gulp.src([
      '!css/ignnore.css', // <== !
      'css/*.css'
    ])
    .pipe(concat('styles.css'))
    .pipe(autoprefix('last 2 versions'))
    .pipe(minifyCss())
    .pipe(gulp.dest('local/view/style/base/css/dist/'));
});