Created
April 4, 2014 05:52
-
-
Save kyeotic/9968875 to your computer and use it in GitHub Desktop.
LiveReload with Grunt and Grunt-Express
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Gruntfile with the configuration of grunt-express and grunt-open. No livereload yet! | |
module.exports = function(grunt) { | |
var port = 3000; | |
// Load Grunt tasks declared in the package.json file | |
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); | |
// Configure Grunt | |
grunt.initConfig({ | |
express: { | |
all: { | |
options: { | |
port: port, | |
hostname: "localhost", | |
bases: [__dirname], | |
livereload: true | |
} | |
} | |
}, | |
watch: { | |
all: { | |
files: ['**/*.{js,css,html}', '!Gruntfile.js'], | |
options: { | |
livereload: true | |
} | |
} | |
}, | |
// grunt-open will open your browser at the project's URL | |
open: { | |
all: { | |
path: 'http://localhost:<%= express.all.options.port%>' | |
} | |
} | |
}); | |
grunt.registerTask('default', ['express', 'open', 'watch']); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"devDependencies": { | |
"grunt": "~0.4.1", | |
"matchdep": "~0.1.2", | |
"grunt-express": "~1.0.0-beta2", | |
"grunt-contrib-watch": "~0.5.1", | |
"grunt-open": "~0.2.1" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment