2

I'm having an issue where I'm unable to compile a set of LESS file using Globbing.

My structure is this:

+ dir3
  - dir3.1
    - dir3.1.1
    - dir3.1.2
  - dir3.2
  - dir3.3
  - responsive.less
  - fixedwidths.less

Each dir has a set of less files and what I'm trying to do is to compile responsive.less and fixedwidths.less but i want to ignore all the remaining folders in dir3.

My Gulp Glob for compiling less files is:

var paths = {
    root: 'Publication/',
    source: 'Publication/LESS/',
    styles: 'Publication/**/*.less'
}

// Compile less files
gulp.task('styles', function() {
    gulp.src([
            paths.source+'**/*.less', // compile it all
            '!'+paths.source+'**/variables.less', // ignore all variables.less
            paths.source+'responsive/*.less', // compile responsive & fixedwidths
            '!'+paths.source+'responsive/**/*.less' // ignore all less files in subdir of dir3
        ])
        .pipe(less())
        .pipe(gulp.dest(paths.root+'build'))
});

I was expecting that paths.source+'responsive/*.less' would match responsive.less and fixedwidths.less and '!'+paths.source+'responsive/**/*.less' would ignore everything else but that's not what seems to be happening. The latter bit code seems to halt all processing of dir3.

Can anything help?

Qasim
  • 168
  • 1
  • 8

1 Answers1

0

There is a bug in node-glob related to negated glob patterns. See this bower issue and this node-glob issue. Maybe your problem is related to this?

If so, this workaround should work './!('+paths.source+'responsive/**/*.less)'.

Brian Clozel
  • 56,583
  • 15
  • 167
  • 176