1 // Generated on 2016-12-19 using generator-angular 0.15.1
5 // for performance reasons we're only matching one level down:
6 // 'test/spec/{,*/}*.js'
7 // use this if you want to recursively match all subfolders:
10 module.exports = function (grunt) {
12 // Time how long tasks take. Can help when optimizing build times
13 require('time-grunt')(grunt);
15 // Automatically load required Grunt tasks
16 require('jit-grunt')(grunt, {
17 useminPrepare: 'grunt-usemin',
18 ngtemplates: 'grunt-angular-templates',
19 cdnify: 'grunt-google-cdn'
22 // Configurable paths for the application
24 app: require('./bower.json').appPath || 'app',
28 // Define the configuration for all the tasks
34 // Watches files for changes and runs tasks based on the changed files
37 files: ['bower.json'],
41 files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
42 tasks: ['newer:jshint:all', 'newer:jscs:all'],
44 livereload: '<%= connect.options.livereload %>'
48 files: ['test/spec/{,*/}*.js'],
49 tasks: ['newer:jshint:test', 'newer:jscs:test', 'karma']
52 files: ['<%= yeoman.app %>/styles/{,*/}*.css','<%= yeoman.app %>/styles/font-awesome/css/{,*/}*.css'],
53 tasks: ['newer:copy:styles', 'postcss']
56 files: ['Gruntfile.js']
60 livereload: '<%= connect.options.livereload %>'
63 '<%= yeoman.app %>/{,*/}*.html',
64 '.tmp/styles/{,*/}*.css',
65 '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
66 '<%= yeoman.app %>/views/{,*/}*.html'
72 // The actual grunt server settings
76 // Change this to '0.0.0.0' to access the server from outside.
77 hostname: 'localhost',
83 middleware: function (connect) {
85 connect.static('.tmp'),
88 connect.static('./bower_components')
92 connect.static('./app/styles')
94 connect.static(appConfig.app)
102 middleware: function (connect) {
104 connect.static('.tmp'),
105 connect.static('test'),
108 connect.static('./bower_components')
110 connect.static(appConfig.app)
118 base: '<%= yeoman.dist %>'
123 // Make sure there are no obvious mistakes
126 jshintrc: '.jshintrc',
127 reporter: require('jshint-stylish')
132 '<%= yeoman.app %>/scripts/{,*/}*.js'
137 jshintrc: 'test/.jshintrc'
139 src: ['test/spec/{,*/}*.js']
143 // Make sure code styles are up to par
152 '<%= yeoman.app %>/scripts/{,*/}*.js'
156 src: ['test/spec/{,*/}*.js']
160 // Empties folders to start fresh
167 '<%= yeoman.dist %>/{,*/}*',
168 '!<%= yeoman.dist %>/.git{,*/}*'
175 // Add vendor prefixed styles
179 require('autoprefixer-core')({ browsers: ['last 1 version'] })
203 // Automatically inject Bower components into the app
206 src: ['<%= yeoman.app %>/index.html'],
210 devDependencies: true,
211 src: '<%= karma.unit.configFile %>',
212 ignorePath: /\.\.\//,
215 block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi,
220 js: '\'{{filePath}}\','
227 // Renames files for browser caching purposes
231 '<%= yeoman.dist %>/scripts/{,*/}*.js',
232 '<%= yeoman.dist %>/styles/{,*/}*.css',
233 '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
234 '<%= yeoman.dist %>/styles/fonts/*'
239 // Reads HTML for usemin blocks to enable smart builds that automatically
240 // concat, minify and revision files. Creates configurations in memory so
241 // additional tasks can operate on them
243 html: '<%= yeoman.app %>/index.html',
245 dest: '<%= yeoman.dist %>',
249 js: ['concat', 'uglifyjs'],
258 // Performs rewrites based on filerev and the useminPrepare configuration
260 html: ['<%= yeoman.dist %>/{,*/}*.html'],
261 css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
262 js: ['<%= yeoman.dist %>/scripts/{,*/}*.js'],
265 '<%= yeoman.dist %>',
266 '<%= yeoman.dist %>/images',
267 '<%= yeoman.dist %>/styles'
270 js: [[/(images\/[^''""]*\.(png|jpg|jpeg|gif|webp|svg))/g, 'Replacing references to images']]
275 // The following *-min tasks will produce minified files in the dist folder
276 // By default, your `index.html`'s <!-- Usemin block --> will take care of
277 // minification. These next options are pre-configured if you do not wish
278 // to use the Usemin blocks.
282 // '<%= yeoman.dist %>/styles/main.css': [
283 // '.tmp/styles/{,*/}*.css'
291 // '<%= yeoman.dist %>/scripts/scripts.js': [
292 // '<%= yeoman.dist %>/scripts/scripts.js'
305 cwd: '<%= yeoman.app %>/images',
306 src: '{,*/}*.{png,jpg,jpeg,gif}',
307 dest: '<%= yeoman.dist %>/images'
313 // cwd:'<%= yeoman.app %>/bower_components/',
314 // src:'**/*.{png,jpg,gif}',
315 // dest: '<%= yeoman.dist %>/styles'
326 // cwd: '<%= yeoman.app %>/bower_components',
327 // src:'{,*/}*.{png,jpg,jpeg,gif}',
328 // dest: '<%= yeoman.dist %>/styles'
340 cwd: '<%= yeoman.app %>/images',
342 dest: '<%= yeoman.dist %>/images'
350 collapseWhitespace: true,
351 conservativeCollapse: true,
352 collapseBooleanAttributes: true,
353 removeCommentsFromCDATA: true
357 cwd: '<%= yeoman.dist %>',
359 dest: '<%= yeoman.dist %>'
368 htmlmin: '<%= htmlmin.dist.options %>',
369 usemin: 'scripts/scripts.js'
371 cwd: '<%= yeoman.app %>',
372 src: 'views/{,*/}*.html',
373 dest: '.tmp/templateCache.js'
377 // ng-annotate tries to make the code safe for minification automatically
378 // by using the Angular long form for dependency injection.
383 cwd: '.tmp/concat/scripts',
385 dest: '.tmp/concat/scripts'
390 // Replace Google CDN references
393 html: ['<%= yeoman.dist %>/*.html']
397 // Copies remaining files to places other tasks can use
403 cwd: '<%= yeoman.app %>',
404 dest: '<%= yeoman.dist %>',
408 'images/{,*/}*.{webp}',
409 'styles/fonts/{,*/}*.*'
415 dest: '<%= yeoman.dist %>/images',
419 cwd: 'bower_components/bootstrap/dist',
421 dest: '<%= yeoman.dist %>'
424 cwd:'bower_components/components-font-awesome',
426 dest: '<%=yeoman.dist%>'
432 cwd: '<%= yeoman.app %>/styles',
433 dest: '.tmp/styles/',
435 'bower_components/{,*/}*.{png,jpg,jpeg,gif}'
440 // Run some tasks in parallel to speed up the build process
459 configFile: 'test/karma.conf.js',
466 grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
467 if (target === 'dist') {
468 return grunt.task.run(['build', 'connect:dist:keepalive']);
476 'connect:livereload',
481 grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
482 grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
483 grunt.task.run(['serve:' + target]);
486 grunt.registerTask('test', [
495 grunt.registerTask('build', [
513 grunt.registerTask('default', [