mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
remove files in watch task when they are deleted
This commit is contained in:
36
gulpfile.js
36
gulpfile.js
@ -6,7 +6,6 @@ var karma = require('karma').server;
|
|||||||
var path = require('path');
|
var path = require('path');
|
||||||
var VinylFile = require('vinyl');
|
var VinylFile = require('vinyl');
|
||||||
var argv = require('yargs').argv;
|
var argv = require('yargs').argv;
|
||||||
var cached = require('gulp-cached');
|
|
||||||
var concat = require('gulp-concat');
|
var concat = require('gulp-concat');
|
||||||
var del = require('del');
|
var del = require('del');
|
||||||
var gulpif = require('gulp-if');
|
var gulpif = require('gulp-if');
|
||||||
@ -85,14 +84,43 @@ gulp.task('watch', function(done) {
|
|||||||
'!ionic/components/*/test/**/*',
|
'!ionic/components/*/test/**/*',
|
||||||
'!ionic/util/test/*'
|
'!ionic/util/test/*'
|
||||||
],
|
],
|
||||||
function() {
|
function(file) {
|
||||||
runSequence('bundle', 'e2e');
|
if (file.event === "unlink") {
|
||||||
|
var basePath = file.base.substring(0, file.base.lastIndexOf("ionic/"));
|
||||||
|
var relPath = file.history[0].replace(base, "").replace(".ts", ".js");
|
||||||
|
|
||||||
|
var es6Path = basePath + "dist/js/es6/" + relPath;
|
||||||
|
var commonPath = basePath + "dist/js/es5/common/" + relPath;
|
||||||
|
var systemPath = basePath + "dist/js/es5/system/" + relPath;
|
||||||
|
|
||||||
|
delete cache.caches.transpile[file.history[0]];
|
||||||
|
|
||||||
|
del([es6Path, commonPath, systemPath], function(){
|
||||||
|
gulp.start('bundle');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
gulp.start('bundle');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
watch('ionic/components/*/test/**/*', function() {
|
watch('ionic/components/*/test/**/*', function(file) {
|
||||||
|
if (file.event === "unlink") {
|
||||||
|
var paths = file.history[0].split("ionic/components/");
|
||||||
|
var basePath = paths[0],
|
||||||
|
relPath = paths[1].split("/test").join("").replace(".ts", ".js");
|
||||||
|
|
||||||
|
var distPath = basePath + "dist/e2e/" + relPath;
|
||||||
|
|
||||||
|
delete cache.caches.e2e[file.history[0]];
|
||||||
|
|
||||||
|
del([distPath], function(){
|
||||||
gulp.start('e2e');
|
gulp.start('e2e');
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
gulp.start('e2e');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
watch('ionic/**/*.scss', function() {
|
watch('ionic/**/*.scss', function() {
|
||||||
gulp.start('sass');
|
gulp.start('sass');
|
||||||
|
Reference in New Issue
Block a user