我是使用gulp.js的初学者,我的网页不受我在index.html文件中所做的更改的影响
我看到了这个错误
server.changed(e.path);
^
TypeError: undefined is not a function我试着改变吞咽的肝脏,但我做不到。
我的gulpfile.js
var gulp = require('gulp'),
gutil = require('gulp-util'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
livereload = require('gulp-livereload'),
lr = require('tiny-lr'),
server = lr();
var jsSources = [
'components/scripts/scriptOne.js',
'components/scripts/scriptTwo.js'
];
gulp.task('js', function() {
gulp.src(jsSources)
.pipe(uglify())
.pipe(concat('script.js'))
.pipe(gulp.dest('js'));
});
gulp.task('watch', function() {
var server = livereload();
gulp.watch(jsSources, ['js']);
gulp.watch(['js/script.js', '*.html'], function(e) {
server.changed(e.path);
});
});
gulp.task('default', ['js', 'watch']);
var gulp = require('gulp'),
gutil = require('gulp-util'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
livereload = require('gulp-livereload'),
lr = require('tiny-lr'),
server = lr();
var jsSources = [
'components/scripts/scriptOne.js',
'components/scripts/scriptTwo.js'
];
gulp.task('js', function() {
gulp.src(jsSources)
.pipe(uglify())
.pipe(concat('script.js'))
.pipe(gulp.dest('js'));
});
gulp.task('watch', function() {
livereload.listen()
var server = livereload();
gulp.watch(jsSources, ['js']);
gulp.watch(['js/script.js', '*.html'], function(e) {
server.changed(e.path);
});
});
gulp.task('default', ['js', 'watch']);
发布于 2015-07-14 19:25:29
Gulp的插件(如LiveReload)经常更新,在这种情况下,会引起轻微的差异,影响Lynda.com的课程。他们在这里发布了更正:
https://stackoverflow.com/questions/28928667
复制相似问题