【发布时间】:2015-05-02 17:58:35
【问题描述】:
我的项目基于 Google Web Starter Kit,并希望将 gulp-preprocess 集成到 gulp 管道中。
我已经设法让它为gulp serve:dist 任务工作,相关代码是:
gulp.task('htmlIncludes', function() {
gulp.src('app/*.html')
.pipe(preprocess({context: { NODE_ENV: 'production', DEBUG: true}}))
.pipe(gulp.dest('./dist/'))
});
gulp.task('default', ['clean'], function (cb) {
runSequence('styles', ['jshint', 'html', 'images', 'fonts', 'copy', 'htmlIncludes'], cb);
});
但是,我无法让它用于包含浏览器同步的 gulp:serve 任务:
gulp.task('serve', ['styles'], function () {
browserSync({
notify: false,
server: ['.tmp', 'app']
});
我想添加htmlIncludes 任务,以便在运行gulp:serve 时更新文件时重新运行它。但是,仅将其添加到当前包含 'styles' 的列表中并没有预期的效果。知道我需要改变什么吗?
【问题讨论】:
标签: gulp google-web-starter-kit