Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #2 from cloud8421/option-not-to-run-indefinitely

Adds option not to run indefinitely.
  • Loading branch information...
commit 55bb60ef88a45b016640681840475034560bb43d 2 parents 8823064 + 6e72092
@iammerrick authored
Showing with 16 additions and 6 deletions.
  1. +8 −3 README.md
  2. +2 −1  grunt.js
  3. +6 −2 tasks/connect.js
View
11 README.md
@@ -1,6 +1,6 @@
# grunt-connect
-Run a connect server, indefinitely. The built in Grunt server task is terrific for the great majority of cases, however sometimes you just want to ability to run a web server on a local file system and interact with the files using a web browser.
+Run a connect server. The built in Grunt server task is terrific for the great majority of cases, however sometimes you just want to ability to run a web server on a local file system and interact with the files using a web browser. For that reason, grunt-connect's default behaviour is to run indefinitely.
## Getting Started
Install this grunt plugin next to your project's [grunt.js gruntfile][getting_started] with: `npm install grunt-connect`
@@ -33,12 +33,17 @@ grunt.initConfig({
port: 1337,
base: 'example'
},
- meta: {
+ test: {
port: 1338,
+ base: 'test',
+ keepAlive: false
+ },
+ meta: {
+ port: 1339,
base: 'tasks'
},
combined: {
- port: 1339,
+ port: 1340,
combine: [
'example',
'tasks'
View
3  grunt.js
@@ -35,7 +35,8 @@ module.exports = function(grunt) {
},
meta: {
port: 1338,
- base: 'tasks'
+ base: 'tasks',
+ keepAlive: false
},
combined: {
port: 1339,
View
8 tasks/connect.js
@@ -20,8 +20,12 @@ module.exports = function(grunt) {
// ==========================================================================
grunt.registerMultiTask('connect', 'Run a simple static connect server till you shut it down.', function() {
- // Don't ever close this task!
- this.async();
+
+ var keepAlive = this.data.keepAlive;
+
+ if (keepAlive === undefined || keepAlive === true) {
+ this.async();
+ }
var port = this.data.port || 1337;
var bases = [];
Please sign in to comment.
Something went wrong with that request. Please try again.