Grunt Livereload + Grunt Connect Proxy
Estoy usando Rails para mi API, AngularJS en el frente y tengo algunos problemas para que livereload / grunt connect proxy funcione correctamente.
Aquí está el fragmento de mi archivo grunt:
connect: {
options: {
port: 9000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: 'localhost',
livereload: 35729
},
proxies: [
{
context: '/api',
host: 'localhost',
port: 3000
}
],
livereload: {
options: {
open: true,
base: [
'.tmp',
'<%= yeoman.app %>'
],
middleware: function (connect, options) {
var middlewares = [];
var directory = options.directory || options.base[options.base.length - 1];
// enable Angular's HTML5 mode
middlewares.push(modRewrite(['!\\.html|\\.js|\\.svg|\\.css|\\.png$ /index.html [L]']));
if (!Array.isArray(options.base)) {
options.base = [options.base];
}
options.base.forEach(function(base) {
// Serve static files.
middlewares.push(connect.static(base));
});
// Make directory browse-able.
middlewares.push(connect.directory(directory));
return middlewares;
}
}
},
test: {
options: {
port: 9001,
base: [
'.tmp',
'test',
'<%= yeoman.app %>'
]
}
},
dist: {
options: {
base: '<%= yeoman.dist %>'
}
}
}
Si yo 'gruño construir' todo funciona perfectamente - apagadolocalhost:3000
Sin embargo, si 'gruñir servir' se abre una ventana a través de127.0.0.1:9000
y recibo 404 para todas mis llamadas API.
También bajo servicio, está destrozando mis imágenes de fondo de un archivo CSS. Recibo esta advertencia:
Resource interpreted as Image but transferred with MIME type text/html: "http://127.0.0.1:9000/images/RBP_BG.jpg"
No he hecho esto antes, así que es probable que lo esté haciendo todo mal.