Skip to content

Instantly share code, notes, and snippets.

@danse
Forked from romaricpascal/Gruntfile.livereload.js
Created October 28, 2013 23:07
Show Gist options
  • Save danse/7206425 to your computer and use it in GitHub Desktop.
Save danse/7206425 to your computer and use it in GitHub Desktop.
// Gruntfile with the configuration of grunt-express and grunt-open. No livereload yet!
module.exports = function(grunt) {
// Load Grunt tasks declared in the package.json file
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// Configure Grunt
grunt.initConfig({
// grunt-express will serve the files from the folders listed in `bases`
// on specified `port` and `hostname`
express: {
all: {
options: {
port: 9000,
hostname: "0.0.0.0",
bases: ['.'],
livereload: true
}
}
},
// grunt-watch will monitor the projects files
watch: {
all: {
files: 'index.html',
options: {
livereload: true
}
}
},
// grunt-open will open your browser at the project's URL
open: {
all: {
// Gets the port from the connect configuration
path: 'http://localhost:<%= express.all.options.port%>'
}
}
});
// Creates the `server` task
grunt.registerTask('server', [
'express',
'open',
'watch'
]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment