Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Livereload not working #126

Open
mrmading opened this issue Nov 2, 2017 · 1 comment
Open

Livereload not working #126

mrmading opened this issue Nov 2, 2017 · 1 comment

Comments

@mrmading
Copy link

mrmading commented Nov 2, 2017

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'] );
@zdenekhatak
Copy link

zdenekhatak commented Nov 13, 2017

The port you are using for livereload is used by something else. Change it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants