Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Starting server on alternate ports. #534

Closed
sebv opened this Issue · 4 comments

4 participants

@sebv

Is it possible? The code below seems to imply that only one set of port/base can be configured in Gruntfile.

var port = grunt.config('server.port') || 8000;
var base = path.resolve(grunt.config('server.base') || '.');
@shama
Owner

You can configure your Gruntfile to use alternate ports like this:

grunt.initConfig({
  server: {
    port: grunt.option('port') || 8000
  }
});

which will use port 8000 unless you specify a different one with: grunt server --port 9000.

@sebv

Ok thanks, and then I should be able to use server as a subtask and configure the port option in the master task.

@tkellen tkellen closed this
@jzacsh jzacsh referenced this issue in thanpolas/generator-closure
Merged

allow overriding hostname and port of grunt server. #14

@callumlocke

for anyone else struggling to make this work: you need an equals sign when setting options from the command line, eg:

$ grunt serve --port=9000
@shama
Owner

Another option if you want to dynamically set to an available port is: https://github.com/shama/grunt-openport

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.