Skip to content

Livereload not working #126

@mrmading

Description

@mrmading

For some reason livereload isn't working even I can see it succesfully injected in the html. Yesterday worked for a while but today it stopped without changing anything in the setup. I get also error of port already in use but even that yesterday it worked:

... Uhoh. Got error listen EADDRINUSE :::35729 ...
Error: listen EADDRINUSE :::35729"

Any idea of what could be happening? I am not running any other thing in that port for sure.

Here is my gulpfile:

var gulp = require('gulp'),
concat = require('gulp-concat'),
minifyCSS = require('gulp-minify-css');
sass = require('gulp-sass');
gls = require('gulp-live-server');
livereload = require('gulp-livereload');

gulp.task('sass', function(){
  gulp.src(['src/sass/**/*.scss'])
    .pipe(sass({includePaths: ['bower_components/foundation/scss']})) // Using gulp-sass
    .pipe(gulp.dest('src/css/'));

});


gulp.task('css',['sass'], function() {
    gulp.src([
        'src/css/**/*.css'
    ])
    //.pipe(minifyCSS())
    .pipe(concat('style.css'))
    .pipe(gulp.dest('public/css'))
    .pipe(livereload());
 });

 gulp.task('js', function() {
    gulp.src([
        'node_modules/jquery/jquery.js',
        'node_modules/bootstrap/js/bootstrap.js',
        'src/js/**/*.js'
    ])
    .pipe(concat('script.js'))
    .pipe(gulp.dest('public/js'));

 });

 gulp.task('images', function() {
    gulp.src([
        'src/images/**/*'
    ])
    .pipe(gulp.dest('public/images'));
 });

 gulp.task('livereload',function(){
  livereload({ start: true });
});

gulp.task('serve', function() {

  var server = gls.static('public', 8888);
  server.start();


 gulp.watch('src/css/**/*.css', function(event) {
    console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
    gulp.run('css');
 });

 gulp.watch('src/js/**/*.js', function(event) {
    console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
    gulp.run('js');
 });

 gulp.watch('src/images/**/*', function(event) {
    console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
    gulp.run('images');
 });
 gulp.watch('src/sass/**/*', function(event) {
    console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
    gulp.run('sass');
 });

});

gulp.task('default', ['sass','images','css', 'livereload','serve'] );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions