Search code examples
javascriptgulp

How I can exclude path in gulp src?


How I can exclude part of gulp src path? There are many paths:

folder/ folder.ru/ folder.com/

And I need to exclude only folders with .ru & .com at end

in my gulpfile

var gulp = require('gulp'),
    uglify = require('gulp-uglify');

gulp.task('run', function () {
        return gulp.src([
            '!landing/*.ru/',
            '!landing/*.com/',

            '!folder/*.ru',
            '!folder/*.com',

            '!folder/*[^ru]',
            '!folder/*[^com]',

            '!folder/*[^ru]/',
            '!folder/*[^com]/',

            'folder/**/js/hello.js',
        ])
        .pipe(uglify())
        .pipe(gulp.dest(function (file) {
            return file.base;
        }))

and it does't work at all, minify all hello.js in all folders


Solution

  • Add this:

    '!**/*.ru/**/*',
    '!**/*.com/**/*',