I have recently setup Gulp in Visual Studio 2017. Experimenting with my first task, I created this:
var gulp = require('gulp');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var uglify = require('gulp-watch');
var uglify = require('gulp-uglify');
gulp.task('minify', function () {
gulp.src('Scripts/PageScripts/**/*.js')
.pipe(uglify())
.pipe(concat('output.js'))
.pipe(gulp.dest('Content'));
});
It works great. I then wanted to add a watch:
gulp.task('watch', function () {
gulp.watch('Scripts/PageScripts/**/*.js', ['minify']);
});
However, this watch task is running old versions of the minify
task. I originally had minify call the file test.js
and rename it to test.min.js
. When I make a change to my Javascript files, output.js
is created, but so is test.js
and test.min.js
. Running "minify" via the Task Explorer runs properly, but the watch seems to have cached some old version.
No amount of manual running of the task or restarting VS2017 will stop it. What am I doing wrong?
Deleting and remaking the gulpfile.js is apparently what it took.