Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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/'));
});
like image 532
Run Avatar asked Nov 03 '14 05:11

Run


2 Answers

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/'));
});
like image 198
jdlm Avatar answered Oct 22 '22 20:10

jdlm


Try this:

gulp.src(['css/**/!(ignore.css)*.css'])
like image 25
qwertymk Avatar answered Oct 22 '22 18:10

qwertymk