Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added --o, --open #10

Closed
wants to merge 1 commit into from

5 participants

@nulltask

added open option.
multi-platform support is powered by domenic's opener :)

@tj
Owner
tj commented

I dont get it :p

@jpillora

Pretty silly though it definitely save time :+1:

@oncletom

It's quite cool, it would enable to open the server URL directly in the browser straight after being started.

@scottstanfield

+1 I just added the same feature and was about to submit a pull request when I saw this item. Really helps save time. I'm always launching open, then alt-tabbing to Chrome, going to a new tab, etc.

@tj
Owner
tj commented

meh, it has nothing to do with the actual running of a server so -1 from me

@tj tj closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 1, 2012
  1. @nulltask

    Added --o, --open

    nulltask authored
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 0 deletions.
  1. +3 −0  bin/serve
  2. +1 −0  package.json
View
3  bin/serve
@@ -10,6 +10,7 @@ var resolve = require('path').resolve
, connect = require('connect')
, stylus = require('stylus')
, jade = require('jade')
+ , opener = require('opener')
, url = require('url')
, fs = require('fs');
@@ -27,6 +28,7 @@ program
.option('-L, --no-logs', 'disable request logging')
.option('-D, --no-dirs', 'disable directory serving')
.option('-f, --favicon <path>', 'serve the given favicon')
+ .option('-o, --open', 'open with your browser')
.parse(process.argv);
// path
@@ -87,5 +89,6 @@ if (program.dirs) {
// start the server
server.listen(program.port, function () {
console.log('\033[90mserving \033[36m%s\033[90m on port \033[96m%d\033[0m', path, program.port);
+ if (program.open) opener('http://localhost' + ':' + program.port);
});
View
1  package.json
@@ -9,6 +9,7 @@
, "stylus": "*"
, "jade": "*"
, "commander": "0.6.1"
+ , "opener": "1.2.x"
}
, "bin": { "serve": "./bin/serve" }
}
Something went wrong with that request. Please try again.