这是我的Gulpfile:
var gulp = require('gulp'),
watch = require('gulp-watch'),
livereload = require('gulp-livereload');
gulp.task('watch', function() {
livereload.listen();
gulp.watch('./css/**/*.css', ['css']).on('change', livereload.changed);
gulp.watch('./js/**/*.js', ['js']).on('change', livereload.changed);
gulp.watch('./**/*.php').on('change', livereload.changed);
});
gulp.task('default', [ 'watch']);它将重新加载CSS一次,然后出现以下错误:
[15:30:13] style.css was reloaded.
[15:30:13] Task 'css' is not in your gulpfile
[15:30:13] Please check the documentation for proper gulpfile formatting不知道该怎么解释,有人有类似的问题吗?
发布于 2014-11-03 03:08:24
首先,您需要用这个CSS创建一个您想要做的任务。
gulp.task('css', function() {
return gulp.src('./css/**/*.css')
.pipe(livereload());
});然后查看此文件,如果更改,请再次运行该任务。
gulp.task('watch', function() {
livereload.listen();
gulp.watch('./css/**/*.css', ['css']);
});
gulp.task('default', [ 'watch']);https://stackoverflow.com/questions/26706962
复制相似问题