Created
May 18, 2013 13:53
-
-
Save stephenplusplus/5604474 to your computer and use it in GitHub Desktop.
This file contains 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
// Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= pkg.name %> <%= pkg.version %> | |
'use strict'; | |
var LIVERELOAD_PORT = 35729; | |
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT}); | |
var mountFolder = function (connect, dir) { | |
return connect.static(require('path').resolve(dir)); | |
}; | |
module.exports = function (grunt) { | |
// load all grunt tasks | |
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); | |
grunt.initConfig({ | |
watch: { | |
options: { | |
nospawn: true, | |
livereload: LIVERELOAD_PORT | |
}, | |
livereload: { | |
files: [ | |
'index.html' | |
] | |
} | |
}, | |
connect: { | |
options: { | |
port: 9000, | |
// change this to '0.0.0.0' to access the server from outside | |
hostname: 'localhost' | |
}, | |
livereload: { | |
options: { | |
middleware: function (connect) { | |
return [ | |
lrSnippet, | |
mountFolder(connect, '.') | |
]; | |
} | |
} | |
} | |
}, | |
open: { | |
server: { | |
path: 'http://localhost:<%= connect.options.port %>' | |
} | |
} | |
}); | |
grunt.registerTask('server', ['connect:livereload', 'open', 'watch']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment