2017-11-27 5 views
0
でsrcと1つのファイルを対象と

I次ゴクゴクタスクを持っている:ウォッチだがガルプ

gulp.task("stylePipe", function(){ 

    var postcssPlugins = [ 
    autoprefixer({browsers: ['last 2 version']}), // autoprefixer 
    cssnano() // css minifier 
    ]; 

    gulp.src("src/sass/*.scss") 
    .pipe(sourcemaps.init()) 
    .pipe(plumber()) 
    .pipe(sass().on("error", sass.logError)) // scan for errors 
    .pipe(postcss(postcssPlugins)) // runs postcss plugins listed above 
    .pipe(rename({ extname: '.min.css' })) 
    .pipe(sourcemaps.write('maps')) 
    .pipe(gulp.dest("dist/css")); // compile into dist 

}); 

gulp.task("styleWatch", ["stylePipe"], browsersync.reload); 

gulp.task("watch", function(){ 

    browsersync({ 
    server: { 
     baseDir: "dist/" 
    } 
    }); 

    gulp.watch("src/sass/*.scss", ["styleWatch"]); 
}); 

私は

enter image description here

の下に記載されているすべてのサブディレクトリ内の変更を監視したいです

gulp.src( "src/sass/*。scss")内のmain.scss(main.scssはサブディレクトリのファイルに変更があるたびに前処理する必要がある唯一のファイルです)。

どうすればこの問題を解決できますか?

答えて

0

Iは単に

gulp.watch("src/sass/**/*.scss", ["styleWatch"]); 

gulp.watch("src/sass/*.scss", ["styleWatch"]); 

修飾しました