Skip to content

Instantly share code, notes, and snippets.

@stormslowly
Created May 26, 2014 08:27
Show Gist options
  • Save stormslowly/3011d126ec8abd7b3b06 to your computer and use it in GitHub Desktop.
Save stormslowly/3011d126ec8abd7b3b06 to your computer and use it in GitHub Desktop.
Grunt-live-reload
'use strict';
/*global module:false , require:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Task configuration.
connect: {
options: {
port: 9000,
// change this to '0.0.0.0' to access the server from outside
hostname: '0.0.0.0',
base: '.'
},
livereload: {
options: {
middleware: function (connect, options) {
return [
require('connect-livereload')({port:35737}),
// Serve static files.
connect.static(options.base),
// Make empty directories browsable.
connect.directory(options.base)
];
}
}
},
},
watch: {
livereload: {
options: {
livereload: 35737
},
files: [
'index.html',
'js/*.js',
'*.css',
'img/*.*'
]
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
// Default task.
grunt.registerTask('default', ['connect','watch']);
};
{
"name": "application-name",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node app.js"
},
"dependencies": {
},
"engines": {
"node": "0.10.22"
},
"devDependencies": {
"grunt": "~0.4.2",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-connect": "~0.7.1",
"connect-livereload": "~0.3.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment