Skip to content

Instantly share code, notes, and snippets.

@abachuk
Created April 2, 2014 14:27
Show Gist options
  • Save abachuk/9935253 to your computer and use it in GitHub Desktop.
Save abachuk/9935253 to your computer and use it in GitHub Desktop.
// The actual grunt server settings
connect: {
options: {
port: 9000,
hostname: 'localhost',
livereload: 35729
},
proxies: [{
context: '/api', // the context of the data service
host: 'mydomain.com/apis/', // wherever the data service is running
changeOrigin: true,
rewrite: {
// the key '^/api' is a regex for the path to be rewritten
// the value is the context of the data service
'^/api': '/smartphone'
}
}],
livereload: {
options: {
open: true,
base: [
'.tmp',
'<%= yeoman.app %>'
],
middleware: function (connect, options) {
var middlewares = [];
if (!Array.isArray(options.base)) {
options.base = [options.base];
}
// Setup the proxy
middlewares.push(require('grunt-connect-proxy/lib/utils').proxyRequest);
// Serve static files
options.base.forEach(function(base) {
middlewares.push(connect.static(base));
});
return middlewares;
}
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment