gulp-livereload icon indicating copy to clipboard operation
gulp-livereload copied to clipboard

Server is stucked on start and nothing happens.

Open interist32 opened this issue 5 years ago • 1 comments

Hi,

I start livereload.listen() in watch task of my Gulp file and it looks like the server is trying to start, but then stops at a certain moment. Here's debugging information:

[21:57:29] Starting 'serve'...
  tinylr:server Configuring HTTP server +0ms
  snapdragon:compiler initializing C:\projects\outrun\node_modules\snapdragon\lib\compiler.js +0ms
  snapdragon:parser initializing C:\projects\outrun\node_modules\snapdragon\lib\parser.js +6ms
  snapdragon:compiler initializing C:\projects\outrun\node_modules\snapdragon\lib\compiler.js +9ms
  snapdragon:parser initializing C:\projects\outrun\node_modules\snapdragon\lib\parser.js +6ms
  gulp:livereload now listening on port 35729 +0ms
  snapdragon:compiler initializing C:\projects\outrun\node_modules\snapdragon\lib\compiler.js +60ms
  snapdragon:parser initializing C:\projects\outrun\node_modules\snapdragon\lib\parser.js +2ms
  snapdragon:compiler initializing C:\projects\outrun\node_modules\snapdragon\lib\compiler.js +2ms
  snapdragon:parser initializing C:\projects\outrun\node_modules\snapdragon\lib\parser.js +1ms

As we can see from the debugging log it says it listening on the port 35729. If I open the browser with this port I see

{
tinylr: "Welcome",
version: "1.1.1"
}

But not the content I'm trying to serve. I suppose I should specify the directory where it should serve from, but can't find how to do it.

I use:

  • Windows 10
  • Gulp 4.0.2
  • gulp-livereload 4.0.2

Gulpfile.js:

const {series, parallel, src, dest, watch} = require('gulp');
const concatCss = require('gulp-concat-css');
const del = require('del');
const config = require('./config');
const livereload = require('gulp-livereload');

function clean(cb) {
  return del([config.distFiles]);
}

function css() {
  return src(config.css.sourceFiles)
      .pipe(concatCss(config.css.bundleName))
      .pipe(dest(config.distDir))
      .pipe(livereload());
}

function copyAssets(cb) {
  return src(config.html.sourceFiles)
      .pipe(dest(config.distDir))
      .pipe(livereload());
}

const build = series(clean, parallel(copyAssets, css));

exports.build = build;

exports.serve = function() {
  livereload.listen();
  watch(config.sourceFiles, {delay: 500}, build);
};

interist32 avatar Jul 08 '20 05:07 interist32

Seems like this package doesn't include any server to serve static and only provides livereload itself. Sorry for confusing and please feel free to close the issue.

interist32 avatar Jul 08 '20 05:07 interist32