tschaub / gulp-newer

Pass through newer source files only
https://npmjs.org/package/gulp-newer
226 stars 24 forks source link

Using gulp-newer to compile a LESS file with @import #16

Closed danielbayerlein closed 8 years ago

danielbayerlein commented 9 years ago

gulp-newer ignored @import in LESS files.


Example

a.less imported b.less

@import "b.less";

If I change b.less, gulp-newer does not recompile a.less.


Source

gulp.task('less', function() {
  return gulp.src('lib/a.less')
    .pipe(newer('dist/a.css'))
    .pipe(less())
    .pipe(gulp.dest('dist'));
});
danielbayerlein commented 9 years ago

@tschaub Do you have any idea how to solve the problem? Thanks!

tschaub commented 9 years ago

Since the newer plugin is not specific to LESS, it doesn't know anything about @import. One general way to handle this problem would be to configure newer with a function that resolves dependencies for incoming source files. Unfortunately, to create this function correctly involves reproducing a lot of work done elsewhere (e.g. in the less plugin).