tschaub / gulp-newer

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

Used for many directories #13

Closed movie4 closed 9 years ago

movie4 commented 9 years ago

Hello!

Сan not set up gulp-newer correctly to work with directories, all files fall into .pipe(browserSync.reload());

appList.forEach(function(folder) {
    appName = folder.match(/.+\/(.+)\/$/)[1];
    gulp.src(getConcatFiles(appName, type))
        .pipe(filter(['*.html', '*.jinja2']))
        .pipe(newer(getExistConcatFile(appName, type)))
        .pipe(browserSync.reload({ stream:true }));
});

getConcatFiles(appName, type) - return files array

getExistConcatFile(appName, type) - return array with path like bellow: ./app/accounts/templates/ ../itcase-dev/itcase-cart/cart/static/cart/templates/ ./app/experts/templates/ ./app/plupload/templates/ ./templates/

Thanks for your answer.

tschaub commented 9 years ago

I'm not sure I totally understand your setup, but newer will compare modification times of incoming source files to corresponding files in a single output directory. The assumption is that newer is part of a chain of gulp streams that is creating the output files.

In the example you give, it is not clear what is responsible for creating the files in the directories returned by getExistConcatFile, but in any case, newer does need to be provided a single dest directory path so it can compare input to output file modification times.

movie4 commented 9 years ago

Thank for your answer and an explanation of 'newer' works.