Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
Allow multiple grunt projects to 'serve'
Browse files Browse the repository at this point in the history
- Make connect not port greedy
- Allow disabling livereload with `--no-livereload`
  • Loading branch information
interactivellama committed Dec 4, 2014
1 parent 7e2f93b commit 7f2645f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
module.exports = function(grunt) {
'use strict';

// use --no-livereload to disable livereload. Helpful to 'serve' multiple projects
var isLivereloadEnabled = (typeof grunt.option('livereload') !== 'undefined') ? grunt.option('livereload') : true;

// Project configuration.
grunt.initConfig({
// Metadata
Expand Down Expand Up @@ -113,13 +116,15 @@ module.exports = function(grunt) {
server: {
options: {
hostname: '*',
port: 8000
port: 8000,
useAvailablePort: true // increment port number, if unavailable...
}
},
testServer: {
options: {
hostname: '*',
port: 9000 // allows main server to be run simultaneously
port: 9000, // allows main server to be run simultaneously
useAvailablePort: true // increment port number, if unavailable...
}
}
},
Expand Down Expand Up @@ -309,21 +314,21 @@ module.exports = function(grunt) {
full: {
files: ['Gruntfile.js', 'fonts/**', 'js/**', 'less/**', 'lib/**', 'test/**', 'index.html', 'dev.html'],
options: {
livereload: true
livereload: isLivereloadEnabled
},
tasks: ['test', 'dist']
},
css: {
files: ['Gruntfile.js', 'fonts/**', 'js/**', 'less/**', 'lib/**', 'test/**', 'index.html', 'dev.html'],
options: {
livereload: true
livereload: isLivereloadEnabled
},
tasks: ['distcss']
},
contrib: {
files: ['Gruntfile.js', 'fonts/**', 'js/**', 'less/**', 'lib/**', 'test/**', 'index.html', 'dev.html'],
options: {
livereload: true
livereload: isLivereloadEnabled
},
tasks: ['test']
}
Expand Down

0 comments on commit 7f2645f

Please sign in to comment.