Skip to content

Instantly share code, notes, and snippets.

@aluedeke
Last active December 15, 2015 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aluedeke/5276256 to your computer and use it in GitHub Desktop.
Save aluedeke/5276256 to your computer and use it in GitHub Desktop.
'use strict';
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
module.exports = function (grunt) {
...
var modRewrite = require('connect-modrewrite');
...
grunt.initConfig({
...
connect: {
livereload: {
options: {
port: 9000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: 'localhost',
middleware: function (connect) {
return [
lrSnippet,
modRewrite([
'!\\.html|\\.js|\\.css|\\woff|\\ttf|\\swf$ /index.html'
]),
mountFolder(connect, '.tmp'),
mountFolder(connect, yeomanConfig.app)
];
}
}
},
...
},
...
});
...
};
npm install connect-modrewrite --save-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment