I am trying to add grunt-connect-proxy to my gruntfile.js in the yoman generator angular project (generator-angular 0.15.1), but I canβt get it to work since the way it wrote changes and I am inexperienced in that how Grunt works.
I read a lot of posts about this, and none of them are particularly relevant, and the grunt file seems to often change in the way it implements the middleware for working with the pen. This makes it impossible to work with the document for grunt-connect-proxy.
The hard part is under the loading line.
Here's what it looks like in an angular gruntfile generator:
// The actual grunt server settings 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: 8080, https: false, xforward: false }], livereload: { options: { open: true, // --- how the code looks like before I do anything middleware: function (connect) { return [ connect.static('.tmp'), connect().use('/bower_components', connect.static('./bower_components')), connect().use('/app/styles', connect.static('./app/styles')), connect.static(appConfig.app) ]; } } }, ...
When I look at the documentation, it looks like this:
livereload: { options: { middleware: function (connect, options) { if (!Array.isArray(options.base)) { options.base = [options.base]; }
Can someone help me translate the documentation into a new way of writing a piece of middleware?
Thanks!!
javascript yeoman-generator-angular grunt-connect-proxy
mottosson
source share