2017-11-27 25 views
0
에서 SRC로 하나의 파일을 대상으로

나는 다음과 같은 꿀꺽 작업이 있습니다시계하지만 꿀꺽

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

는 단순히

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

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

수정