Skip to content

Instantly share code, notes, and snippets.

@trecloux
Last active December 18, 2015 08:39
Show Gist options
  • Save trecloux/5756278 to your computer and use it in GitHub Desktop.
Save trecloux/5756278 to your computer and use it in GitHub Desktop.
Grunt proxy configuration
// Juts after var lrSnippet ....
var proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest;
/* ...... */
// Modify the connect task configuration : add proxies section and insert 'proxySnippet' in the middleware
connect: {
proxies: [
{
context: '/rest',
host: 'localhost',
port: 8080,
https: false,
changeOrigin: false
}
],
options: {
port: 9000,
hostname: 'localhost'
},
livereload: {
options: {
middleware: function (connect) {
return [
proxySnippet,
lrSnippet,
mountFolder(connect, '.tmp'),
mountFolder(connect, yeomanConfig.app)
];
}
}
},
/* ...... */
// Modifify the server task to ass the configureProxies step
grunt.registerTask('server', [
'clean:server',
'coffee:dist',
'compass:server',
'configureProxies',
'livereload-start',
'connect:livereload',
'open',
'watch'
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment