2016-07-14 62 views
0

我試圖編譯我的SASS到CSS,但我的吞嚥手錶只在第一個任務 - 哪裏不好?我的文件
gulpfile.js吞併不看所有的任務

var gulp = require('gulp'); 
var sass = require('gulp-sass'); 


gulp.task('styles', function() { 
    gulp.src('sass/*.scss') 
     .pipe(sass().on('error', sass.logError)) 
     .pipe(gulp.dest('./css/')); 
}); 

gulp.task('bootstrap', function() { 
    gulp.src('sass/bootstrap/bootstrap.scss') 
     .pipe(sass().on('error', sass.logError)) 
     .pipe(gulp.dest('./plugins/bootstrap/css/')); 
}); 

gulp.task('default',function() { 
    gulp.watch('sass/*.scss',['styles']); 
    gulp.watch('sass/bootstrap/*.scss',['bootstrap']); 
}); 

結構:

assets 
-- css/ 
---- style.css 
-- node_modules/ 
---- (files from node) 
-- sass/ 
---- bootstrap/ 
------- (parts of bootstrap) 
---- bootstrap.scss 
---- style.scss 
-- gulpfile.js 
-- package.json 

我想編譯:
資產/上海社會科學院/ style.scss - >資產/ CSS/style.css中
assets/sass/bootstrap.scss - > assets/plugins/bootstrap/css/bootstrap.min.css

+0

我認爲只是添加return語句將您的「風格」和‘引導’的任務可能會解決這個問題。另外你的bootstrap.scss會在你頂嘴,它不會出現在你/ *。SCSS流想。 – Mark

回答

0

您是否試過更改默認值跟隨?

gulp.task('styleswatch', function() { 
    gulp.watch('sass/*.scss',['styles']); 
} 
gulp.task('bootstrapwatch', function() { 
    gulp.watch('sass/*.scss',['bootstrap']); 
} 
gulp.task('default',['styleswatch','bootstrapwatch']);