3

複数のフォルダーを通過し、より少ないファイルを監視する gulp タスクを作成しています。コンパイルされた css をパイプして、より少ないファイルの元のフォルダーに戻したいと思います。残念ながら、各ファイルに個別の出力フォルダーを与える良い方法が見つからないようです。

gulp.task('less:watch', function() {
    watch({
        glob: 'src/**/less/**/*.less',
        emit: 'one',
        emitOnGlob: false
    },function(files){
        return files
            .pipe(less({
                paths: [ path.join(__dirname, 'less', 'includes') ]
            }))
            // I need to pipe the files back to the folder they were generated from
            .pipe(gulp.dest(path.join(__dirname, 'less')))
            .on('error', gutil.log);
    });
});
4

1 に答える 1

1

一度に1つのファイルを処理できると思いますgulp.watch

gulp.task('less:watch', function() {
    gulp.watch('src/**/less/**/*.less',function(evnt) {
      return gulp.src(evnt.path)
        .pipe(less({
          paths: [ path.join(__dirname, 'less', 'includes') ]
        }))
        .pipe(gulp.dest(path.dirname(evnt.path)))
        .on('error', gutil.log);
    });
});
于 2014-06-25T20:09:15.137 に答える