Skip to content

Commit

Permalink
chore(yeoman-gruntfile-update): configured grunt-connect-proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
vucalur committed Dec 18, 2013
1 parent 2bf976e commit 4ca7763
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion wibses/yo/Gruntfile.js
Expand Up @@ -7,6 +7,9 @@
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'


var proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest;

module.exports = function (grunt) {

// Load grunt tasks automatically
Expand Down Expand Up @@ -64,6 +67,14 @@ module.exports = function (grunt) {

// The actual grunt server settings
connect: {
proxies: [
{
context: '/',
host: 'localhost',
port: 8000, // Django port goes here
xforward: true
}
],
options: {
port: 9000,
// Change this to '0.0.0.0' to access the server from outside.
Expand All @@ -76,7 +87,17 @@ module.exports = function (grunt) {
base: [
'.tmp',
'<%= yeoman.app %>'
]
],
// http://stackoverflow.com/a/19403176/1432478 this Dude just have saved half of my day :-)
middleware: function (connect, options) {
var middlewares = [];
options.base.forEach(function (base) {
// Serve static files.
middlewares.push(connect.static(base));
});
middlewares.push(proxySnippet);
return middlewares;
}
}
},
test: {
Expand Down Expand Up @@ -366,6 +387,7 @@ module.exports = function (grunt) {
});

grunt.loadNpmTasks('grunt-bower-install');
grunt.loadNpmTasks('grunt-connect-proxy');


grunt.registerTask('serve', function (target) {
Expand All @@ -375,6 +397,7 @@ module.exports = function (grunt) {

grunt.task.run([
'clean:server',
'configureProxies',
'concurrent:server',
'autoprefixer',
'connect:livereload',
Expand Down

0 comments on commit 4ca7763

Please sign in to comment.