gulp-community / gulp-livereload

gulp plugin for livereload
768 stars 67 forks source link

Server is stucked on start and nothing happens. #146

Open interist32 opened 4 years ago

interist32 commented 4 years ago

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:

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 commented 4 years ago

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.