当我在 index.html 文件中进行更改时,我的网页没有更新
My web page dosn't updated when i made changes in index.html file
我是使用 gulp.js 的初学者,我的网页不受我在 index.html 文件中所做更改的影响
我看到这个错误
server.changed(e.path);
^
TypeError: undefined is not a function
我尝试在 gulp-livereload 中进行更改,但我做不到。
我的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']);
Gulp 的插件(如 LiveReload)经常更新,在这种情况下,会导致影响 Lynda.com 课程的细微差异。他们在这里发布了更正:
我是使用 gulp.js 的初学者,我的网页不受我在 index.html 文件中所做更改的影响
我看到这个错误
server.changed(e.path);
^
TypeError: undefined is not a function
我尝试在 gulp-livereload 中进行更改,但我做不到。
我的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']);
Gulp 的插件(如 LiveReload)经常更新,在这种情况下,会导致影响 Lynda.com 课程的细微差异。他们在这里发布了更正: