My gulp-watch
task has been started normally, and the gulp
command didn't exit too, every seems good. However, when I make changes to my files, I can't see the changes in my output files, and there was nothing logged in the command line. It seems like gulp can't detect that my files was changed. But running the watched tasks alone will work.
It is strange. My watch
task was working perfectly before. But I can't remember what did I do after the last right run.
Here is my directory structure (part of it):
├── README.md
├── bower.json
├── config.xml
├── gulpfile.js
├── ionic.project
├── src
│ ├── jade
│ │ ├── index.jade
│ │ └── templates/
│ ├── js
│ │ ├── app.js
│ │ ├── modules/
│ │ └── services/
│ └── scss
│ └── ionic.app.scss
└── www
├── README.md
├── css
│ ├── ionic.app.css
│ ├── ionic.app.min.css
│ └── style.css
├── index.html
├── js
│ └── app.js
└── templates
├── about.html
├── home.html
├── tabs.html
└── test.html
Here is my gulpfile.js
:
var gulp = require('gulp');
var gutil = require('gulp-util');
var bower = require('bower');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
var jade = require('gulp-jade');
var sh = require('shelljs');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var paths = {
sass: ['./src/scss/**/*.scss'],
jade: ['./src/jade/**/*.jade'],
js: ['./src/js/**/*.js']
};
gulp.task('default', ['sass', 'templates', 'scripts', 'watch']);
gulp.task('sass', function(done) {
gulp.src('./src/scss/ionic.app.scss')
.pipe(sass())
.on('error', sass.logError)
.pipe(gulp.dest('./www/css/'))
.pipe(minifyCss({
keepSpecialComments: 0
}))
.pipe(rename({ extname: '.min.css' }))
.pipe(gulp.dest('./www/css/'))
.on('end', done);
});
gulp.task('templates', function (done) {
gulp.src('./src/jade/**/*.jade')
.pipe(jade({
pretty: true
}))
.pipe(gulp.dest('./www/'));
});
gulp.task('scripts', function (done) {
var bundleStream = browserify('./src/js/app.js').bundle();
bundleStream
.pipe(source('app.js'))
.pipe(rename('app.js'))
.pipe(gulp.dest('./www/js/'));
});
gulp.task('watch', function() {
gulp.watch(paths.sass, ['sass']);
gulp.watch(paths.jade, ['templates']);
gulp.watch('./src/js/app.js', ['scripts']);
});
gulp.task('install', ['git-check'], function() {
return bower.commands.install()
.on('log', function(data) {
gutil.log('bower', gutil.colors.cyan(data.id), data.message);
});
});
gulp.task('git-check', function(done) {
if (!sh.which('git')) {
console.log(
' ' + gutil.colors.red('Git is not installed.'),
'\n Git, the version control system, is required to download Ionic.',
'\n Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.',
'\n Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.'
);
process.exit(1);
}
done();
});
Need your help...