hiddentao / gulp-server-livereload

Gulp plugin to run a local webserver with livereload enabled via socket.io. Also comes with standalone command-line interface.
MIT License
93 stars 28 forks source link

Didn't open web server #54

Closed ymatuhin closed 4 years ago

ymatuhin commented 6 years ago

My gulp task:

gulp.task('server', ['clean'], () =>
  gulp.src(config.dist).pipe(
    $.serverLivereload({
      livereload: true,
      directoryListing: true,
      host: '0.0.0.0',
      open: true,
      port: 5000,
    }),
  ),
);

Output in console:

[22:46:07] Starting 'server'...
[22:46:07] Finished 'server' after 210 ms
sant123 commented 6 years ago

Please try with these single settings:

const gulp = require("gulp");
const server = require("gulp-server-livereload");

gulp.task("webserver", function () {
    gulp.src("app")
        .pipe(server({
            livereload: true,
            open: true
        }));
});

Maybe the problem is in clean task.

sant123 commented 6 years ago

After that, in the console use gulp webserver or add it into the package.json.

{
  "scripts": {
    "start": "gulp webserver"
  },
  "dependencies": {
    "gulp": "^3.9.1",
    "gulp-server-livereload": "^1.9.2"
  }
}

Then use npm start or yarn start

dylan-chong commented 6 years ago

don't you also need fallback: index.html as well?