Code Monkey home page Code Monkey logo

Comments (5)

dasilvacontin avatar dasilvacontin commented on July 17, 2024

If it's a confirmed bug, +1.

from gulp-webserver.

xdissent avatar xdissent commented on July 17, 2024

You can use multiple servers by providing explicit livereload ports:

gulp.task('webserver', function() {
    gulp.src('./public')
        .pipe(webserver({
            host: 'localhost',
            port: 7000,
            fallback: 'index.html',
            livereload: {enable: true, port: 2345}
        }));
    gulp.src('./public/build')
        .pipe(webserver({
            host: 'localhost',
            port: 7001,
            fallback: 'index.html',
            livereload: {enable: true, port: 2346}
        }));
});

You have to add the enable flag or the livereload server will be disabled due to the way options are merged.

Right now I'm having trouble getting multiple livereload servers to actually reload, but I suspect that is because I'm trying to watch the same folder twice. I believe it works fine if you're serving two different folders. Edit: fixed in newer version

from gulp-webserver.

arkhemlol avatar arkhemlol commented on July 17, 2024

I have the following problem: browser tries to inject livereload script using url with default port 35729, although the specific port was provided. I also checked that node is listening on provided port. Here is the code snippet:

gulp.task('webserver-dev', function() {
    gulp.src('./')
        .pipe(webserver({
            livereload: {enable: true, port: 2346},
            directoryListing: false,
            open: true,
            port: 9000,
            host: '10.1.1.17',
            fallback: 'index.html'
        }));
});
gulp.task('webserver', function() {
    gulp.src('./build')
        .pipe(webserver({
            livereload: {enable: true, port: 2345},
            directoryListing: false,
            open: true,
            host: '10.1.1.17',
            fallback: 'index.html'
        }));
});

Script is trying to inject using url: http://10.1.1.17:35729/livereload.js?snipver=1
Thanks in advance.

from gulp-webserver.

tamtakoe avatar tamtakoe commented on July 17, 2024

Use custom port for livereload is not comfortable. This is good if gulp-webserver increments livereload port when livereload: true

from gulp-webserver.

dasilvacontin avatar dasilvacontin commented on July 17, 2024

Otherwise, an error with friendly info should be thrown.
(e.g When using multiple livereload servers you must specify a different port number for each of them).

from gulp-webserver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.