当我启动gulp时会生成文件,但是当它进入监视模式时,会理解存在更改但不会覆盖文件:
我的gulp样本
var argv = require('yargs').argv;
var gulp = require('gulp');
var gulpif = require('gulp-if');
var uglify = require('gulp-uglify');
var dependencies = [
'core-js/client/*.min.js',
'zone.js/dist/zone.js',
'reflect-metadata/Reflect.js',
'systemjs/dist/system.src.js',
'rxjs/**/*.js',
'@angular/**/*.js',
'angular2-in-memory-web-api/*.js',
];
var modules = [
// Example: 'iconv-lite/**/*',
];
........
gulp.task("javascript", () => {
return gulp.src([
'./bower_components/jquery/dist/jquery.min.js',
'./bower_components/bootstrap/dist/js/bootstrap.min.js',
])
.pipe(gulp.dest("./build/js"))
});
gulp.task('styles', () => {
var postcss = require('gulp-postcss');
var autoreset = require('postcss-autoreset');
var simplevars = require('postcss-simple-vars');
var nested = require('postcss-nested');
var lost = require('lost');
var cssnext = require('postcss-cssnext');
var processors = [
simplevars(),
nested(),
lost(),
cssnext(),
];
return gulp.src([
'./src/css/*.css',
'./bower_components/openSans/openSans.css',
'./bower_components/components-font-awesome/css/font-awesome.min.css',
'./bower_components/bootstrap/dist/css/bootstrap.min.css',
])
.pipe(postcss(processors))
.pipe(gulp.dest('./build/css'));
});
gulp.task('ts', ['ts-app', 'ts-electron']);
gulp.task('build', ['templates', 'resources', 'styles', 'ts', 'libs', 'modules', 'images', 'javascript']);
gulp.task('watch', ['build'], () => {
gulp.watch('./src/app/**/*', ['ts-app']);
gulp.watch('./src/electron/**/*', ['ts-electron']);
gulp.watch('./src/resources/**/*', ['resources']);
gulp.watch('./src/css/**/*', ['styles']);
gulp.watch('./src/templates/**/*', ['templates']);
gulp.watch('./src/img/**/*', ['images']);
gulp.watch('./src/js/**/*', ['javascript']);
});
平台:Win7x64 NPM:3.10.8 NODE:v6.7.0 Gulp版本:
{
"gulp": "^3.9.1",
"gulp-if": "^2.0.1",
"gulp-postcss": "^6.1.1",
"gulp-pug": "^3.0.3",
"gulp-typescript": "^2.13.6",
"gulp-uglify": "^1.5.4",
}
我还尝试手动放置gulp.dest("./build/", {overwrite: true})
(在所有gulp.dest中),但没有任何改变:/
我该怎么做才能更好地理解这个问题?