Search code examples
coffeescriptgulpgulp-watch

My web page dosn't updated when i made changes in index.html file


I'm beginner in useing gulp.js , My web page Not affected by changes that I made in my index.html file

and i see this error

    server.changed(e.path);
       ^
TypeError: undefined is not a function

i try to make a changes in gulp-livereload but i can't make it .

my 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']);


Solution

  • Plugins for Gulp (like LiveReload) update often and, in this case, cause slight differences that affect Lynda.com's courses. They released corrections here:

    https://github.com/planetoftheweb/coffeescript