Split the modularity patch into smaller pieces. Add the yangui module
[dlux.git] / Gruntfile.js
index 2afed9b6e4348aaecdcf67ac320da253e9c53e1e..672dc9e9ed9a8dcf70aec9f8a62b0e6b2764ced9 100644 (file)
-var lrSnippet = require('connect-livereload')();
-var mountFolder = function (connect, dir) {
-    return connect.static(require('path').resolve(dir));
-};
-
-module.exports = function ( grunt ) {
-  
-  /** 
-   * Load required Grunt tasks. These are installed based on the versions listed
-   * in `package.json` when you do `npm install` in this directory.
-   */
-  grunt.loadNpmTasks('grunt-contrib-clean');
-  grunt.loadNpmTasks('grunt-contrib-copy');
-  grunt.loadNpmTasks('grunt-contrib-jshint');
-  grunt.loadNpmTasks('grunt-contrib-concat');
-  grunt.loadNpmTasks('grunt-contrib-watch');
-  grunt.loadNpmTasks('grunt-contrib-uglify');
-  grunt.loadNpmTasks('grunt-contrib-coffee');
-  grunt.loadNpmTasks('grunt-conventional-changelog');
-  grunt.loadNpmTasks('grunt-bump');
-  grunt.loadNpmTasks('grunt-coffeelint');
-  //grunt.loadNpmTasks('grunt-recess');
-  grunt.loadNpmTasks('grunt-karma');
-  grunt.loadNpmTasks('grunt-ngmin');
-  grunt.loadNpmTasks('grunt-html2js');
-  grunt.loadNpmTasks('grunt-contrib-less');
-  grunt.loadNpmTasks('grunt-contrib-connect');
-  grunt.loadNpmTasks('grunt-open');
-
-  /**
-   * Load in our build configuration file.
-   */
-  var userConfig = require( './build.config.js' );
-
-  /**
-   * This is the configuration object Grunt uses to give each plugin its 
-   * instructions.
-   */
-  var taskConfig = {
-    /**
-     * We read in our `package.json` file so we can access the package name and
-     * version. It's already there, so we don't repeat ourselves here.
-     */
-    pkg: grunt.file.readJSON("package.json"),
-
-    /**
-     * The banner is the comment that is placed at the top of our compiled 
-     * source files. It is first processed as a Grunt template, where the `<%=`
-     * pairs are evaluated based on this very configuration object.
-     */
-    meta: {
-      banner: 
-        '/**\n' +
-        ' * <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
-        ' * <%= pkg.homepage %>\n' +
-        ' *\n' +
-        ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
-        ' * Licensed <%= pkg.licenses.type %> <<%= pkg.licenses.url %>>\n' +
-        ' */\n'
-    },
-
-    /**
-     * Creates a changelog on a new version.
-     */
-    changelog: {
-      options: {
-        dest: 'CHANGELOG.md',
-        template: 'changelog.tpl'
-      }
-    },
-
-    /**
-     * Increments the version number, etc.
-     */
-    bump: {
-      options: {
-        files: [
-          "package.json", 
-          "bower.json"
-        ],
-        commit: false,
-        commitMessage: 'chore(release): v%VERSION%',
-        commitFiles: [
-          "package.json", 
-          "client/bower.json"
-        ],
-        createTag: false,
-        tagName: 'v%VERSION%',
-        tagMessage: 'Version %VERSION%',
-        push: false,
-        pushTo: 'origin'
-      }
-    },    
-
-    /**
-     * The directories to delete when `grunt clean` is executed.
-     */
-    clean: [ 
-      '<%= build_dir %>', 
-      '<%= compile_dir %>'
-    ],
-
-    /**
-     * The `copy` task just copies files from A to B. We use it here to copy
-     * our project assets (images, fonts, etc.) and javascripts into
-     * `build_dir`, and then to copy the assets to `compile_dir`.
-     */
-    copy: {
-      build_app_assets: {
-        files: [
-          { 
-            src: [ '**' ],
-            dest: '<%= build_dir %>/assets/',
-            cwd: 'src/assets',
-            expand: true
-          }
-       ]   
-      },
-      build_vendor_assets: {
-        files: [
-          { 
-            src: [ '<%= vendor_files.assets %>' ],
-            dest: '<%= build_dir %>/assets/',
-            cwd: '.',
-            expand: true,
-            flatten: true
-          }
-       ]   
-      },
-      build_appjs: {
-        files: [
-          {
-            src: [ '<%= app_files.js %>' ],
-            dest: '<%= build_dir %>/',
-            cwd: '.',
-            expand: true
-          }
-        ]
-      },
-      build_vendorjs: {
-        files: [
-          {
-            src: [ '<%= vendor_files.js %>' ],
-            dest: '<%= build_dir %>/',
-            cwd: '.',
-            expand: true
-          }
-        ]
-      },
-      build_vendorimages: {
-        files: [
-          {
-            src: [ '<%= vendor_files.images %>' ],
-            dest: '<%= build_dir %>/',
-            cwd: '.',
-            expand: true
-          }
-        ]
-      },
-      build_vendorcss: {
-        files: [
-          {
-            src: [ '<%= vendor_files.css %>' ],
-            dest: '<%= build_dir %>',
-            cwd: '.',
-            expand: true
-          }
-        ]
-      },
-      compile_assets: {
-        files: [
-          {
-            src: [ '**' ],
-            dest: '<%= compile_dir %>/assets',
-            cwd: '<%= build_dir %>/assets',
-            expand: true
-          }
-        ]
-      },
-
-     /* build_vendor_font: {
-        files: [
-          {
-            src: [ '<%= vendor_files.font %>' ],
-            dest: '<%= build_dir %>',
-            cwd: '.',
-            expand: true
-          }
-        ]
-      },*/
-
-      compile_font: {
-        files: [
-          {
-            src: [ '**' ],
-            dest: '<%= compile_dir %>/font',
-            cwd: '<%= build_dir %>/font',
-            expand: true
-          }
-        ]
-      }
-    },
-
-    /**
-     * `grunt concat` concatenates multiple source files into a single file.
-     */
-    concat: {
-      /**
-       * The `build_css` target concatenates compiled CSS and vendor CSS
-       * together.
-       */
-      build_css: {
-        src: [
-          '<%= vendor_files.css %>',
-          '<%= build_dir %>/assets/<%= pkg.name %>-<%= pkg.version %>.css'
-        ],
-        dest: '<%= build_dir %>/assets/<%= pkg.name %>-<%= pkg.version %>.css'
-      },
-      /**
-       * The `compile_js` target is the concatenation of our application source
-       * code and all specified vendor source code into a single file.
-       */
-      compile_js: {
-        options: {
-          banner: '<%= meta.banner %>'
-        },
-        src: [ 
-          '<%= vendor_files.js %>', 
-          'module.prefix', 
-          '<%= build_dir %>/src/**/*.js', 
-          '<%= html2js.common.dest %>', 
-          '<%= html2js.app.dest %>', 
-          'module.suffix' 
-        ],
-        dest: '<%= compile_dir %>/assets/<%= pkg.name %>-<%= pkg.version %>.js'
-      }
-    },
-
-    /**
-     * `grunt coffee` compiles the CoffeeScript sources. To work well with the
-     * rest of the build, we have a separate compilation task for sources and
-     * specs so they can go to different places. For example, we need the
-     * sources to live with the rest of the copied JavaScript so we can include
-     * it in the final build, but we don't want to include our specs there.
-     */
-    coffee: {
-      source: {
-        options: {
-          bare: true
-        },
-        expand: true,
-        cwd: '.',
-        src: [ '<%= app_files.coffee %>' ],
-        dest: '<%= build_dir %>',
-        ext: '.js'
-      }
-    },
-
-    /**
-     * `ng-min` annotates the sources before minifying. That is, it allows us
-     * to code without the array syntax.
-     */
-    ngmin: {
-      compile: {
-        files: [
-          {
-            src: [ '<%= app_files.js %>' ],
-            cwd: '<%= build_dir %>',
-            dest: '<%= build_dir %>',
-            expand: true
-          }
-        ]
-      }
-    },
-
-    /**
-     * Minify the sources!
-     */
-    uglify: {
-      compile: {
-        options: {
-          banner: '<%= meta.banner %>'
-        },
-        files: {
-          '<%= concat.compile_js.dest %>': '<%= concat.compile_js.dest %>'
-        }
-      }
-    },
-
-    /**
-     * `recess` handles our LESS compilation and uglification automatically.
-     * Only our `main.less` file is included in compilation; all other files
-     * must be imported from this file.
-     */
-   /**recess: {
-      build: {
-        src: [ '<%= app_files.less %>' ],
-        dest: '<%= build_dir %>/assets/<%= pkg.name %>-<%= pkg.version %>.css',
-        options: {
-          compile: true,
-          compress: false,
-          noUnderscores: false,
-          noIDs: false,
-          zeroUnits: false
-        }
-      },
-      compile: {
-        src: [ '<%= recess.build.dest %>' ],
-        dest: '<%= recess.build.dest %>',
-        options: {
-          compile: true,
-          compress: true,
-          noUnderscores: false,
-          noIDs: false,
-          zeroUnits: false
-        }
-      }
-    }, **/
-
-      /**
-       * `less` less plugin handles the LESS compilation and minification automatically
-       * this has been changed to the LESS plugin from recess plugin above because of
-       * out of memory issues with the original plugin.
-       */
-
-      less: {
-          development: {
-              options: {
-                  paths: ["assets/css"],
-                  compress: false,
-                  syncImport: true,
-                  strictImports: true
-              },
-              files: {
-                  '<%= build_dir %>/assets/<%= pkg.name %>-<%= pkg.version %>.css': '<%= app_files.less %>'
-                  }
-          },
-          production: {
-              options: {
-                  paths: ["assets/css"],
-                  compress: true,
-                  cleancss: true
-              },
-              files: {
-                  '<%= build_dir %>/assets/<%= pkg.name %>-<%= pkg.version %>.css': '<%= app_files.less %>'
-              }
-          }
-      },
-
-    /**
-     * `jshint` defines the rules of our linter as well as which files we
-     * should check. This file, all javascript sources, and all our unit tests
-     * are linted based on the policies listed in `options`. But we can also
-     * specify exclusionary patterns by prefixing them with an exclamation
-     * point (!); this is useful when code comes from a third party but is
-     * nonetheless inside `src/`.
-     */
-    jshint: {
-      src: [ 
-        '<%= app_files.js %>'
-      ],
-      test: [
-        '<%= app_files.jsunit %>'
-      ],
-      gruntfile: [
-        'OriginalGruntfile.js'
-      ],
-      options: {
-        curly: true,
-        immed: true,
-        newcap: true,
-        noarg: true,
-        sub: true,
-        boss: true,
-        eqnull: true
-      },
-      globals: {}
-    },
-
-    /**
-     * `coffeelint` does the same as `jshint`, but for CoffeeScript.
-     * CoffeeScript is not the default in ngBoilerplate, so we're just using
-     * the defaults here.
-     */
-    coffeelint: {
-      src: {
-        files: {
-          src: [ '<%= app_files.coffee %>' ]
-        }
-      },
-      test: {
-        files: {
-          src: [ '<%= app_files.coffeeunit %>' ]
-        }
-      }
-    },
-
-    /**
-     * HTML2JS is a Grunt plugin that takes all of your template files and
-     * places them into JavaScript files as strings that are added to
-     * AngularJS's template cache. This means that the templates too become
-     * part of the initial payload as one JavaScript file. Neat!
-     */
-    html2js: {
-      /**
-       * These are the templates from `src/app`.
-       */
-      app: {
-        options: {
-          base: 'src/app'
-        },
-        src: [ '<%= app_files.atpl %>' ],
-        dest: '<%= build_dir %>/templates-app.js'
-      },
-
-      /**
-       * These are the templates from `src/common`.
-       */
-      common: {
-        options: {
-          base: 'src/common'
-        },
-        src: [ '<%= app_files.ctpl %>' ],
-        dest: '<%= build_dir %>/templates-common.js'
-      }
-    },
-
-    /**
-     * The Karma configurations.
-     */
-    karma: {
-      options: {
-        configFile: '<%= build_dir %>/karma-unit.js'
-      },   
-      unit: {
-        runnerPort: 9102,
-        background: true,
-        port: 9877 // IMPORTANT!
-      },
-      continuous: {
-        singleRun: true
-      }
-    },
-
-    /**
-     * The `index` task compiles the `index.html` file as a Grunt template. CSS
-     * and JS files co-exist here but they get split apart later.
-     */
-    index: {
-
-      /**
-       * During development, we don't want to have wait for compilation,
-       * concatenation, minification, etc. So to avoid these steps, we simply
-       * add all script files directly to the `<head>` of `index.html`. The
-       * `src` property contains the list of included files.
-       */
-      build: {
-        dir: '<%= build_dir %>',
-        src: [
-          '<%= vendor_files.js %>',
-          '<%= build_dir %>/src/**/*.js',
-          '<%= html2js.common.dest %>',
-          '<%= html2js.app.dest %>',
-          '<%= vendor_files.css %>',
-          '<%= build_dir %>/assets/<%= pkg.name %>-<%= pkg.version %>.css'
-        ]
-      },
-
-      /**
-       * When it is time to have a completely compiled application, we can
-       * alter the above to include only a single JavaScript and a single CSS
-       * file. Now we're back!
-       */
-      compile: {
-        dir: '<%= compile_dir %>',
-        src: [
-          '<%= concat.compile_js.dest %>',
-          '<%= concat.build_css.dest %>'
-          //'<%= recess.compile.dest %>'
-        ]
-      }
-    },
-
-    /**
-     * This task compiles the karma template so that changes to its file array
-     * don't have to be managed manually.
-     */
-    karmaconfig: {
-      unit: {
-        dir: '<%= build_dir %>',
-        src: [ 
-          '<%= vendor_files.js %>',
-          '<%= html2js.app.dest %>',
-          '<%= html2js.common.dest %>',
-          '<%= app_files.js_common %>',
-          '<%= app_files.js_app %>',
-          '<%= app_files.jsunit %>'
-        ]
-      }
-    },
-     connect: {
-      livereload: {
-        options: {
-          port: 9000,
-          hostname: '0.0.0.0',
-          middleware: function (connect) {
-            return [
-              mountFolder(connect, 'build'),
-              lrSnippet
-            ];
-          }
-        }
-      },
-      dev: {
-        options: {
-          hostname: '0.0.0.0',
-          port: 9000,
-          base: 'build'
-        }
-      },
-      prod: {
-        options: {
-          port: 9001,
-          base: 'bin',
-          keepalive: true
-        }
-      }
-    },
-    open: {
-      dev: {
-        path: 'http://127.0.0.1:9000/'
-      },
-      prod: {
-        path: 'http://127.0.0.1:9001/'
-      }
-    },
-    /**
-     * And for rapid development, we have a watch set up that checks to see if
-     * any of the files listed below change, and then to execute the listed 
-     * tasks when they do. This just saves us from having to type "grunt" into
-     * the command-line every time we want to see what we're working on; we can
-     * instead just leave "grunt watch" running in a background terminal. Set it
-     * and forget it, as Ron Popeil used to tell us.
-     *
-     * But we don't need the same thing to happen for all the files. 
-     */
-    delta: {
-      /**
-       * By default, we want the Live Reload to work for all tasks; this is
-       * overridden in some tasks (like this file) where browser resources are
-       * unaffected. It runs by default on port 35729, which your browser
-       * plugin should auto-detect.
-       */
-      options: {
-        livereload: true
-      },
-
-      /**
-       * When the Gruntfile changes, we just want to lint it. In fact, when
-       * your Gruntfile changes, it will automatically be reloaded!
-       */
-      gruntfile: {
-        files: 'OriginalGruntfile.js',
-        tasks: [ 'jshint:gruntfile' ],
-        options: {
-          livereload: false
-        }
-      },
-
-      /**
-       * When our JavaScript source files change, we want to run lint them and
-       * run our unit tests.
-       */
-      jssrc: {
-        files: [ 
-          '<%= app_files.js %>'
-        ],
-        tasks: [ 'jshint:src', 'karma:unit:run', 'copy:build_appjs' ]
-      },
-
-      /**
-       * When our CoffeeScript source files change, we want to run lint them and
-       * run our unit tests.
-       */
-      coffeesrc: {
-        files: [ 
-          '<%= app_files.coffee %>'
-        ],
-        tasks: [ 'coffeelint:src', 'coffee:source', 'karma:unit:run', 'copy:build_appjs' ]
-      },
-
-      /**
-       * When assets are changed, copy them. Note that this will *not* copy new
-       * files, so this is probably not very useful.
-       */
-      assets: {
-        files: [ 
-          'src/assets/**/*'
-        ],
-        tasks: [ 'copy:build_assets' ]
-      },
-
-      /**
-       * When index.html changes, we need to compile it.
-       */
-      html: {
-        files: [ '<%= app_files.html %>' ],
-        tasks: [ 'index:build' ]
-      },
-
-      /**
-       * When our templates change, we only rewrite the template cache.
-       */
-      tpls: {
-        files: [ 
-          '<%= app_files.atpl %>', 
-          '<%= app_files.ctpl %>'
-        ],
-        tasks: [ 'html2js' ]
-      },
-
-      /**
-       * When the CSS files change, we need to compile and minify them.
-       */
-      less: {
-        files: [ 'src/**/*.less' ],
-        tasks: [ 'less:development' ]
-      },
-
-      /**
-       * When a JavaScript unit test file changes, we only want to lint it and
-       * run the unit tests. We don't want to do any live reloading.
-       */
-      jsunit: {
-        files: [
-          '<%= app_files.jsunit %>'
-        ],
-        tasks: [ 'jshint:test', 'karma:unit:run' ],
-        options: {
-          livereload: false
-        }
-      },
-
-      /**
-       * When a CoffeeScript unit test file changes, we only want to lint it and
-       * run the unit tests. We don't want to do any live reloading.
-       */
-      coffeeunit: {
-        files: [
-          '<%= app_files.coffeeunit %>'
-        ],
-        tasks: [ 'coffeelint:test', 'karma:unit:run' ],
-        options: {
-          livereload: false
-        }
-      }
-    }
-  };
-
-  grunt.initConfig( grunt.util._.extend( taskConfig, userConfig ) );
-
-  /**
-   * In order to make it safe to just compile or copy *only* what was changed,
-   * we need to ensure we are starting from a clean, fresh build. So we rename
-   * the `watch` task to `delta` (that's why the configuration var above is
-   * `delta`) and then add a new task called `watch` that does a clean build
-   * before watching for changes.
-   */
-  grunt.renameTask( 'watch', 'delta' );
-  grunt.registerTask( 'watch', [ 'build', 'karma:unit', 'delta' ] );
-
-  grunt.registerTask('live', ['build', 'connect:dev', 'delta']);
-  /**
-   * The default task is to build and compile.
-   */
-  grunt.registerTask( 'default', [ 'build', 'compile' ] );
-
-  /**
-   * The `build` task gets your app ready to run for development and testing.
-   */
-  grunt.registerTask( 'build', [
-    'clean', 'html2js', 'jshint', 'coffeelint', 'coffee', 'less:development',
-    'concat:build_css', 'copy:build_app_assets', 'copy:build_vendor_assets',
-    'copy:build_appjs', 'copy:build_vendorimages', 'copy:build_vendorjs', 'copy:build_vendorcss', 'karmaconfig', /*'copy:build_vendor_font',*/ 'index:build'/*, 
-    'karma:continuous'  */
-  ]);
-
-  /**
-   * The `compile` task gets your app ready for deployment by concatenating and
-   * minifying your code.
-   */
-  grunt.registerTask( 'compile', [
-      'less:production', 'concat:build_css', 'copy:compile_assets', 'ngmin:compile', 'concat:compile_js', 'uglify', 'index:compile'
-  ]);
-
-  /**
-   * A utility function to get all app JavaScript sources.
-   */
-  function filterForJS ( files ) {
-    return files.filter( function ( file ) {
-      return file.match( /\.js$/ );
-    });
-  }
-
-  /**
-   * A utility function to get all app CSS sources.
-   */
-  function filterForCSS ( files ) {
-    return files.filter( function ( file ) {
-      return file.match( /\.css$/ );
-    });
-  }
-
-  /** 
-   * The index.html template includes the stylesheet and javascript sources
-   * based on dynamic names calculated in this Gruntfile. This task assembles
-   * the list into variables for the template to use and then runs the
-   * compilation.
-   */
-  grunt.registerMultiTask( 'index', 'Process index.html template', function () {
-    var dirRE = new RegExp( '^('+grunt.config('build_dir')+'|'+grunt.config('compile_dir')+')\/', 'g' );
-    var jsFiles = filterForJS( this.filesSrc ).map( function ( file ) {
-      return file.replace( dirRE, '' );
-    });
-    var cssFiles = filterForCSS( this.filesSrc ).map( function ( file ) {
-      return file.replace( dirRE, '' );
-    });
-
-    grunt.file.copy('src/index.html', this.data.dir + '/index.html', { 
-      process: function ( contents, path ) {
-        return grunt.template.process( contents, {
-          data: {
-            scripts: jsFiles,
-            styles: cssFiles,
-            version: grunt.config( 'pkg.version' )
-          }
-        });
-      }
-    });
-
-    grunt.file.copy('src/login.html', this.data.dir + '/login.html', { 
-      process: function ( contents, path ) {
-        return grunt.template.process( contents, {
-          data: {
-            scripts: jsFiles,
-            styles: cssFiles,
-            version: grunt.config( 'pkg.version' )
-          }
-        });
-      }
-    });
-  });
-
-  /**
-   * In order to avoid having to specify manually the files needed for karma to
-   * run, we use grunt to manage the list for us. The `karma/*` files are
-   * compiled as grunt templates for use by Karma. Yay!
-   */
-  grunt.registerMultiTask( 'karmaconfig', 'Process karma config templates', function () {
-    var jsFiles = filterForJS( this.filesSrc );
-    
-    grunt.file.copy( 'karma/karma-unit.tpl.js', grunt.config( 'build_dir' ) + '/karma-unit.js', { 
-      process: function ( contents, path ) {
-        return grunt.template.process( contents, {
-          data: {
-            scripts: jsFiles
-          }
-        });
-      }
-    });
-  });
-
-};
+var lrSnippet = require('connect-livereload')();\r
+var mountFolder = function (connect, dir) {\r
+    return connect.static(require('path').resolve(dir));\r
+};\r
+\r
+module.exports = function ( grunt ) {\r
+  \r
+  /** \r
+   * Load required Grunt tasks. These are installed based on the versions listed\r
+   * in `package.json` when you do `npm install` in this directory.\r
+   */\r
+  grunt.loadNpmTasks('grunt-contrib-clean');\r
+  grunt.loadNpmTasks('grunt-contrib-copy');\r
+  grunt.loadNpmTasks('grunt-contrib-jshint');\r
+  grunt.loadNpmTasks('grunt-contrib-concat');\r
+  grunt.loadNpmTasks('grunt-contrib-watch');\r
+  grunt.loadNpmTasks('grunt-contrib-uglify');\r
+  grunt.loadNpmTasks('grunt-conventional-changelog');\r
+  grunt.loadNpmTasks('grunt-bump');\r
+  //grunt.loadNpmTasks('grunt-recess');\r
+  grunt.loadNpmTasks('grunt-karma');\r
+  grunt.loadNpmTasks('grunt-ngmin');\r
+  grunt.loadNpmTasks('grunt-html2js');\r
+  grunt.loadNpmTasks('grunt-contrib-less');\r
+  grunt.loadNpmTasks('grunt-contrib-connect');\r
+  grunt.loadNpmTasks('grunt-open');\r
+\r
+  /**\r
+   * Load in our build configuration file.\r
+   */\r
+  var userConfig = require( './build.config.js' );\r
+\r
+  /**\r
+   * This is the configuration object Grunt uses to give each plugin its \r
+   * instructions.\r
+   */\r
+  var taskConfig = {\r
+    /**\r
+     * We read in our `package.json` file so we can access the package name and\r
+     * version. It's already there, so we don't repeat ourselves here.\r
+     */\r
+    pkg: grunt.file.readJSON("package.json"),\r
+\r
+    /**\r
+     * The banner is the comment that is placed at the top of our compiled \r
+     * source files. It is first processed as a Grunt template, where the `<%=`\r
+     * pairs are evaluated based on this very configuration object.\r
+     */\r
+    meta: {\r
+      banner: \r
+        '/**\n' +\r
+        ' * <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +\r
+        ' * <%= pkg.homepage %>\n' +\r
+        ' *\n' +\r
+        ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +\r
+        ' * Licensed <%= pkg.licenses.type %> <<%= pkg.licenses.url %>>\n' +\r
+        ' */\n'\r
+    },\r
+\r
+    /**\r
+     * Creates a changelog on a new version.\r
+     */\r
+    changelog: {\r
+      options: {\r
+        dest: 'CHANGELOG.md',\r
+        template: 'changelog.tpl'\r
+      }\r
+    },\r
+\r
+    /**\r
+     * Increments the version number, etc.\r
+     */\r
+    bump: {\r
+      options: {\r
+        files: [\r
+          "package.json", \r
+          "bower.json"\r
+        ],\r
+        commit: false,\r
+        commitMessage: 'chore(release): v%VERSION%',\r
+        commitFiles: [\r
+          "package.json", \r
+          "client/bower.json"\r
+        ],\r
+        createTag: false,\r
+        tagName: 'v%VERSION%',\r
+        tagMessage: 'Version %VERSION%',\r
+        push: false,\r
+        pushTo: 'origin'\r
+      }\r
+    },    \r
+\r
+    /**\r
+     * The directories to delete when `grunt clean` is executed.\r
+     */\r
+    clean: [ \r
+      '<%= build_dir %>', \r
+      '<%= compile_dir %>'\r
+    ],\r
+\r
+    /**\r
+     * The `copy` task just copies files from A to B. We use it here to copy\r
+     * our project assets (images, fonts, etc.) and javascripts into\r
+     * `build_dir`, and then to copy the assets to `compile_dir`.\r
+     */\r
+    copy: {\r
+      build_app_assets: {\r
+        files: [\r
+          { \r
+            src: [ '**' ],\r
+            dest: '<%= build_dir %>/assets/',\r
+            cwd: 'src/assets',\r
+            expand: true\r
+          }\r
+       ]   \r
+      },\r
+      build_vendor_assets: {\r
+        files: [\r
+          { \r
+            src: [ '<%= vendor_files.assets %>' ],\r
+            dest: '<%= build_dir %>/assets/',\r
+            cwd: '.',\r
+            expand: true,\r
+            flatten: true\r
+          }\r
+       ]   \r
+      },\r
+      build_appjs: {\r
+        files: [\r
+          {\r
+            src: [ '<%= app_files.js %>' ],\r
+            dest: '<%= build_dir %>/',\r
+            cwd: '.',\r
+            expand: true\r
+          }\r
+        ]\r
+      },\r
+      copy_template: {\r
+        files: [\r
+          {\r
+            src: ['<%= app_files.templates %>'],\r
+            dest: '<%= build_dir %>/',\r
+            cwd: '.',\r
+            expand: true\r
+          }\r
+        ]\r
+      },\r
+      build_vendorjs: {\r
+        files: [\r
+          {\r
+            src: [ '<%= vendor_files.js %>' ],\r
+            dest: '<%= build_dir %>/',\r
+            cwd: '.',\r
+            expand: true\r
+          }\r
+        ]\r
+      },\r
+      build_vendorimages: {\r
+        files: [\r
+          {\r
+            src: [ '<%= vendor_files.images %>' ],\r
+            dest: '<%= build_dir %>/',\r
+            cwd: '.',\r
+            expand: true\r
+          }\r
+        ]\r
+      },\r
+      build_vendorcss: {\r
+        files: [\r
+          {\r
+            src: [ '<%= vendor_files.css %>' ],\r
+            dest: '<%= build_dir %>',\r
+            cwd: '.',\r
+            expand: true\r
+          }\r
+        ]\r
+      },\r
+      compile_assets: {\r
+        files: [\r
+          {\r
+            src: [ '**' ],\r
+            dest: '<%= compile_dir %>/assets',\r
+            cwd: '<%= build_dir %>/assets',\r
+            expand: true\r
+          }\r
+        ]\r
+      },\r
+\r
+      compile_font: {\r
+        files: [\r
+          {\r
+            src: [ '**' ],\r
+            dest: '<%= compile_dir %>/font',\r
+            cwd: '<%= build_dir %>/font',\r
+            expand: true\r
+          }\r
+        ]\r
+      }\r
+    },\r
+\r
+    /**\r
+     * `grunt concat` concatenates multiple source files into a single file.\r
+     */\r
+    concat: {\r
+      /**\r
+       * The `build_css` target concatenates compiled CSS and vendor CSS\r
+       * together.\r
+       */\r
+      build_css: {\r
+        src: [\r
+          '<%= vendor_files.css %>',\r
+          '<%= build_dir %>/assets/<%= pkg.name %>-<%= pkg.version %>.css'\r
+        ],\r
+        dest: '<%= build_dir %>/assets/<%= pkg.name %>-<%= pkg.version %>.css'\r
+      },\r
+      /**\r
+       * The `compile_js` target is the concatenation of our application source\r
+       * code and all specified vendor source code into a single file.\r
+       */\r
+      compile_js: {\r
+        options: {\r
+          banner: '<%= meta.banner %>'\r
+        },\r
+        src: [ \r
+          '<%= vendor_files.js %>', \r
+          'module.prefix', \r
+          '<%= build_dir %>/src/**/*.js', \r
+          '<%= html2js.common.dest %>', \r
+          '<%= html2js.app.dest %>', \r
+          'module.suffix' \r
+        ],\r
+        dest: '<%= compile_dir %>/assets/<%= pkg.name %>-<%= pkg.version %>.js'\r
+      }\r
+    },\r
+\r
+    /**\r
+     * `ng-min` annotates the sources before minifying. That is, it allows us\r
+     * to code without the array syntax.\r
+     */\r
+    ngmin: {\r
+      compile: {\r
+        files: [\r
+          {\r
+            src: [ '<%= app_files.js %>' ],\r
+            cwd: '<%= build_dir %>',\r
+            dest: '<%= build_dir %>',\r
+            expand: true\r
+          }\r
+        ]\r
+      }\r
+    },\r
+\r
+    /**\r
+     * Minify the sources!\r
+     */\r
+    uglify: {\r
+      compile: {\r
+        options: {\r
+          banner: '<%= meta.banner %>'\r
+        },\r
+        files: {\r
+          '<%= concat.compile_js.dest %>': '<%= concat.compile_js.dest %>'\r
+        }\r
+      }\r
+    },\r
+      \r
+      /**\r
+       * `less` less plugin handles the LESS compilation and minification automatically\r
+       * this has been changed to the LESS plugin from recess plugin above because of\r
+       * out of memory issues with the original plugin.\r
+       */\r
+\r
+      less: {\r
+          development: {\r
+              options: {\r
+                  paths: ["assets/css"],\r
+                  compress: false,\r
+                  syncImport: true,\r
+                  strictImports: true\r
+              },\r
+              files: {\r
+                  '<%= build_dir %>/assets/<%= pkg.name %>-<%= pkg.version %>.css': '<%= app_files.less %>'\r
+                  }\r
+          },\r
+          production: {\r
+              options: {\r
+                  paths: ["assets/css"],\r
+                  compress: true,\r
+                  cleancss: true\r
+              },\r
+              files: {\r
+                  '<%= build_dir %>/assets/<%= pkg.name %>-<%= pkg.version %>.css': '<%= app_files.less %>'\r
+              }\r
+          }\r
+      },\r
+\r
+    /**\r
+     * `jshint` defines the rules of our linter as well as which files we\r
+     * should check. This file, all javascript sources, and all our unit tests\r
+     * are linted based on the policies listed in `options`. But we can also\r
+     * specify exclusionary patterns by prefixing them with an exclamation\r
+     * point (!); this is useful when code comes from a third party but is\r
+     * nonetheless inside `src/`.\r
+     */\r
+    jshint: {\r
+      src: [ \r
+        '<%= app_files.js %>'\r
+      ],\r
+      test: [\r
+        '<%= app_files.jsunit %>'\r
+      ],\r
+      gruntfile: [\r
+        'OriginalGruntfile.js'\r
+      ],\r
+      options: {\r
+        curly: true,\r
+        immed: true,\r
+        newcap: true,\r
+        noarg: true,\r
+        sub: true,\r
+        boss: true,\r
+        eqnull: true\r
+      },\r
+      globals: {}\r
+    },\r
+   \r
+\r
+    /**\r
+     * HTML2JS is a Grunt plugin that takes all of your template files and\r
+     * places them into JavaScript files as strings that are added to\r
+     * AngularJS's template cache. This means that the templates too become\r
+     * part of the initial payload as one JavaScript file. Neat!\r
+     */\r
+    html2js: {\r
+      /**\r
+       * These are the templates from `src/app`.\r
+       */\r
+      app: {\r
+        options: {\r
+          base: 'src/app'\r
+        },\r
+        src: [ '<%= app_files.atpl %>' ],\r
+        dest: '<%= build_dir %>/templates-app.js'\r
+      },\r
+\r
+      /**\r
+       * These are the templates from `src/common`.\r
+       */\r
+      common: {\r
+        options: {\r
+          base: 'src/common'\r
+        },\r
+        src: [ '<%= app_files.ctpl %>' ],\r
+        dest: '<%= build_dir %>/templates-common.js'\r
+      }\r
+    },\r
+\r
+    /**\r
+     * The Karma configurations.\r
+     */\r
+    karma: {\r
+      options: {\r
+        configFile: '<%= build_dir %>/karma-unit.js'\r
+      },   \r
+      unit: {\r
+        runnerPort: 9102,\r
+        background: true,\r
+        port: 9877 // IMPORTANT!\r
+      },\r
+      continuous: {\r
+        singleRun: true\r
+      }\r
+    },\r
+\r
+    /**\r
+     * The `index` task compiles the `index.html` file as a Grunt template. CSS\r
+     * and JS files co-exist here but they get split apart later.\r
+     */\r
+    index: {\r
+\r
+      /**\r
+       * During development, we don't want to have wait for compilation,\r
+       * concatenation, minification, etc. So to avoid these steps, we simply\r
+       * add all script files directly to the `<head>` of `index.html`. The\r
+       * `src` property contains the list of included files.\r
+       */\r
+      build: {\r
+        dir: '<%= build_dir %>',\r
+        src: [\r
+          '<%= html2js.common.dest %>',\r
+          '<%= html2js.app.dest %>',\r
+          '<%= vendor_files.css %>',\r
+          '<%= build_dir %>/assets/<%= pkg.name %>-<%= pkg.version %>.css'\r
+        ]\r
+      },\r
+\r
+      /**\r
+       * When it is time to have a completely compiled application, we can\r
+       * alter the above to include only a single JavaScript and a single CSS\r
+       * file. Now we're back!\r
+       */\r
+      compile: {\r
+        dir: '<%= compile_dir %>',\r
+        src: [\r
+          '<%= concat.compile_js.dest %>',\r
+          '<%= concat.build_css.dest %>'\r
+          //'<%= recess.compile.dest %>'\r
+        ]\r
+      }\r
+    },\r
+\r
+    /**\r
+     * This task compiles the karma template so that changes to its file array\r
+     * don't have to be managed manually.\r
+     */\r
+    karmaconfig: {\r
+      unit: {\r
+        dir: '<%= build_dir %>',\r
+        src: [ \r
+          '<%= vendor_files.js %>',\r
+          '<%= html2js.app.dest %>',\r
+          '<%= html2js.common.dest %>',\r
+          '<%= app_files.js_common %>',\r
+          '<%= app_files.js_app %>',\r
+          '<%= app_files.jsunit %>'\r
+        ]\r
+      }\r
+    },\r
+     connect: {\r
+      livereload: {\r
+        options: {\r
+          port: 9000,\r
+          hostname: '0.0.0.0',\r
+          middleware: function (connect) {\r
+            return [\r
+              mountFolder(connect, 'build'),\r
+              lrSnippet\r
+            ];\r
+          }\r
+        }\r
+      },\r
+      dev: {\r
+        options: {\r
+          hostname: '0.0.0.0',\r
+          port: 9000,\r
+          base: 'build'\r
+        }\r
+      },\r
+      prod: {\r
+        options: {\r
+          port: 9001,\r
+          base: 'bin',\r
+          keepalive: true\r
+        }\r
+      }\r
+    },\r
+    open: {\r
+      dev: {\r
+        path: 'http://127.0.0.1:9000/'\r
+      },\r
+      prod: {\r
+        path: 'http://127.0.0.1:9001/'\r
+      }\r
+    },\r
+    /**\r
+     * And for rapid development, we have a watch set up that checks to see if\r
+     * any of the files listed below change, and then to execute the listed \r
+     * tasks when they do. This just saves us from having to type "grunt" into\r
+     * the command-line every time we want to see what we're working on; we can\r
+     * instead just leave "grunt watch" running in a background terminal. Set it\r
+     * and forget it, as Ron Popeil used to tell us.\r
+     *\r
+     * But we don't need the same thing to happen for all the files. \r
+     */\r
+    delta: {\r
+      /**\r
+       * By default, we want the Live Reload to work for all tasks; this is\r
+       * overridden in some tasks (like this file) where browser resources are\r
+       * unaffected. It runs by default on port 35729, which your browser\r
+       * plugin should auto-detect.\r
+       */\r
+      options: {\r
+        livereload: true\r
+      },\r
+\r
+      /**\r
+       * When the Gruntfile changes, we just want to lint it. In fact, when\r
+       * your Gruntfile changes, it will automatically be reloaded!\r
+       */\r
+      gruntfile: {\r
+        files: 'OriginalGruntfile.js',\r
+        tasks: [ 'jshint:gruntfile' ],\r
+        options: {\r
+          livereload: false\r
+        }\r
+      },\r
+\r
+      /**\r
+       * When our JavaScript source files change, we want to run lint them and\r
+       * run our unit tests.\r
+       */\r
+      jssrc: {\r
+        files: [ \r
+          '<%= app_files.js %>'\r
+        ],\r
+        tasks: [ 'jshint:src', 'karma:unit:run', 'copy:build_appjs' ]\r
+      },\r
+\r
+      /**\r
+       * When assets are changed, copy them. Note that this will *not* copy new\r
+       * files, so this is probably not very useful.\r
+       */\r
+      assets: {\r
+        files: [ \r
+          'src/assets/**/*'\r
+        ],\r
+        tasks: [ 'copy:build_app_assets' ]\r
+      },\r
+\r
+      /**\r
+       * When index.html changes, we need to compile it.\r
+       */\r
+      html: {\r
+        files: [ '<%= app_files.html %>' ],\r
+        tasks: [ 'index:build' ]\r
+      },\r
+\r
+      /**\r
+       * When our templates change, we only rewrite the template cache.\r
+       */\r
+      tpls: {\r
+        files: [ \r
+          '<%= app_files.atpl %>', \r
+          '<%= app_files.ctpl %>'\r
+        ],\r
+        tasks: [ 'html2js' ]\r
+      },\r
+\r
+      /**\r
+       * When the CSS files change, we need to compile and minify them.\r
+       */\r
+      less: {\r
+        files: [ 'src/**/*.less' ],\r
+        tasks: [ 'less:development' ]\r
+      },\r
+\r
+      /**\r
+       * When a JavaScript unit test file changes, we only want to lint it and\r
+       * run the unit tests. We don't want to do any live reloading.\r
+       */\r
+      jsunit: {\r
+        files: [\r
+          '<%= app_files.jsunit %>'\r
+        ],\r
+        tasks: [ 'jshint:test', 'karma:unit:run' ],\r
+        options: {\r
+          livereload: false\r
+        }\r
+      }\r
+    }\r
+  };\r
+\r
+  grunt.initConfig( grunt.util._.extend( taskConfig, userConfig ) );\r
+\r
+  /**\r
+   * In order to make it safe to just compile or copy *only* what was changed,\r
+   * we need to ensure we are starting from a clean, fresh build. So we rename\r
+   * the `watch` task to `delta` (that's why the configuration var above is\r
+   * `delta`) and then add a new task called `watch` that does a clean build\r
+   * before watching for changes.\r
+   */\r
+  grunt.renameTask( 'watch', 'delta' );\r
+  grunt.registerTask( 'watch', [ 'build', 'karma:unit', 'delta' ] );\r
+\r
+  grunt.registerTask('live', ['build', 'connect:dev', 'delta']);\r
+  /**\r
+   * The default task is to build and compile.\r
+   */\r
+  grunt.registerTask( 'default', [ 'build', 'compile' ] );\r
+\r
+  /**\r
+   * The `build` task gets your app ready to run for development and testing.\r
+   */\r
+  grunt.registerTask( 'build', [\r
+    'clean', 'html2js', 'jshint', 'less:development',\r
+    'concat:build_css', 'copy:build_app_assets', 'copy:build_vendor_assets',\r
+    'copy:build_appjs', 'copy:copy_template', 'copy:build_vendorimages', 'copy:build_vendorjs', 'copy:build_vendorcss', 'karmaconfig', 'index:build'\r
+  ]);\r
+\r
+  /**\r
+   * The `compile` task gets your app ready for deployment by concatenating and\r
+   * minifying your code.\r
+   */\r
+  grunt.registerTask( 'compile', [\r
+      'less:production', 'concat:build_css', 'copy:compile_assets', 'ngmin:compile', 'concat:compile_js', 'uglify', 'index:compile'\r
+  ]);\r
+\r
+  /**\r
+   * A utility function to get all app JavaScript sources.\r
+   */\r
+  function filterForJS ( files ) {\r
+    return files.filter( function ( file ) {\r
+      return file.match( /\.js$/ );\r
+    });\r
+  }\r
+\r
+  /**\r
+   * A utility function to get all app CSS sources.\r
+   */\r
+  function filterForCSS ( files ) {\r
+    return files.filter( function ( file ) {\r
+      return file.match( /\.css$/ );\r
+    });\r
+  }\r
+\r
+  /** \r
+   * The index.html template includes the stylesheet and javascript sources\r
+   * based on dynamic names calculated in this Gruntfile. This task assembles\r
+   * the list into variables for the template to use and then runs the\r
+   * compilation.\r
+   */\r
+  grunt.registerMultiTask( 'index', 'Process index.html template', function () {\r
+    var dirRE = new RegExp( '^('+grunt.config('build_dir')+'|'+grunt.config('compile_dir')+')\/', 'g' );\r
+    var jsFiles = filterForJS( this.filesSrc ).map( function ( file ) {\r
+      return file.replace( dirRE, '' );\r
+    });\r
+    var cssFiles = filterForCSS( this.filesSrc ).map( function ( file ) {\r
+      return file.replace( dirRE, '' );\r
+    });\r
+\r
+    grunt.file.copy('src/index.html', this.data.dir + '/index.html', { \r
+      process: function ( contents, path ) {\r
+        return grunt.template.process( contents, {\r
+          data: {\r
+            scripts: jsFiles,\r
+            styles: cssFiles,\r
+            version: grunt.config( 'pkg.version' )\r
+          }\r
+        });\r
+      }\r
+    });\r
+\r
+    grunt.file.copy('src/login.html', this.data.dir + '/login.html', { \r
+      process: function ( contents, path ) {\r
+        return grunt.template.process( contents, {\r
+          data: {\r
+            scripts: jsFiles,\r
+            styles: cssFiles,\r
+            version: grunt.config( 'pkg.version' )\r
+          }\r
+        });\r
+      }\r
+    });\r
+  });\r
+\r
+  /**\r
+   * In order to avoid having to specify manually the files needed for karma to\r
+   * run, we use grunt to manage the list for us. The `karma/*` files are\r
+   * compiled as grunt templates for use by Karma. Yay!\r
+   */\r
+  grunt.registerMultiTask( 'karmaconfig', 'Process karma config templates', function () {\r
+    var jsFiles = filterForJS( this.filesSrc );\r
+    \r
+    grunt.file.copy( 'karma/karma-unit.tpl.js', grunt.config( 'build_dir' ) + '/karma-unit.js', { \r
+      process: function ( contents, path ) {\r
+        return grunt.template.process( contents, {\r
+          data: {\r
+            scripts: jsFiles\r
+          }\r
+        });\r
+      }\r
+    });\r
+  });\r
+\r
+};\r