Running "grunt server" in development

Some time ago @jvassev pointed me to Yeoman, a great set of tools that really improved my productivity when developing JavaScript apps. One of the tools it wraps is Grunt, it is used to automate common tasks when developing a project, like running a preview of the project, building it and testing it.

I am working on a project, where we are running the “grunt server” task that starts a static server so we can preview and test out changes of the front end code. Together with that it can run livereload that will listen to file changes, so that when a file is changed, the browser is automatically refreshed, or also compass server that will compile all your sass files, and others.

In order to develop in an environment as close as the production environment, you should query your back-end API. This can be done with this neat grunt plugin, that, https://github.com/drewzboto/grunt-connect-proxy . So basically if you run “grunt server” locally, then it can serve you the static files, and request to the back-end API can be proxied to your web server.

You can check this post that explains more.

Advertisements