bier hier bier hier - 2 years ago 89
AngularJS Question

How to serve dev version of angularapp in grunt?

I am trying to serve my angular app with grunt and express. Currently the serve task looks like this:

module.exports = function(grunt) {
grunt.registerTask('serve', function(target) {

// Default task[
// init
// compile html, styles, and scripts

// 'uglify',
// 'Karma',


I just want to serve the angular app without any copying, minification etc. How can I do this?

Answer Source

A simplest way

I suggest that you use to use Browserify which is one of the simplest way to serve a JS app via Grunt. Here is an example that supposes your JS application is in an src directory with an index.html at its root :


module.exports = function(grunt) {
    browserSync: {
      bsFiles: {
        src: './src/**/*'
      options: {
        server: './src'


  grunt.registerTask('default', ['browserSync']);

You obviously need to install grunt-browser-sync before (npm i -D grunt-browser-sync).

With Express

If you still wish to use express because that's you'll do in production, I suggest you the grunt-express plugin, there is a complete example app using Angular, Express and Grunt here. It's 3 years old but is still working for an actual Angular + Express application.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download