1 // Generated on 2017-05-31 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'],
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}'
70 // The actual grunt server settings
74 // Change this to '0.0.0.0' to access the server from outside.
75 hostname: 'localhost',
81 middleware: function(connect) {
83 connect.static('.tmp'),
86 connect.static('./bower_components')
90 connect.static('./app/styles')
92 connect.static(appConfig.app)
100 middleware: function(connect) {
102 connect.static('.tmp'),
103 connect.static('test'),
106 connect.static('./bower_components')
108 connect.static(appConfig.app)
116 base: '<%= yeoman.dist %>'
121 // Make sure there are no obvious mistakes
124 jshintrc: '.jshintrc',
125 reporter: require('jshint-stylish')
130 '<%= yeoman.app %>/scripts/{,*/}*.js'
135 jshintrc: 'test/.jshintrc'
137 src: ['test/spec/{,*/}*.js']
141 // Make sure code styles are up to par
150 '<%= yeoman.app %>/scripts/{,*/}*.js'
154 src: ['test/spec/{,*/}*.js']
158 // Empties folders to start fresh
165 '<%= yeoman.dist %>/{,*/}*',
166 '!<%= yeoman.dist %>/.git{,*/}*'
173 // Add vendor prefixed styles
177 require('autoprefixer-core')({ browsers: ['last 1 version'] })
201 // Automatically inject Bower components into the app
204 src: ['<%= yeoman.app %>/index.html'],
208 devDependencies: true,
209 src: '<%= karma.unit.configFile %>',
210 ignorePath: /\.\.\//,
213 block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi,
218 js: '\'{{filePath}}\','
225 // Renames files for browser caching purposes
229 '<%= yeoman.dist %>/scripts/{,*/}*.js',
230 '<%= yeoman.dist %>/styles/{,*/}*.css',
231 '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
232 '<%= yeoman.dist %>/styles/fonts/*'
237 // Reads HTML for usemin blocks to enable smart builds that automatically
238 // concat, minify and revision files. Creates configurations in memory so
239 // additional tasks can operate on them
241 html: '<%= yeoman.app %>/index.html',
243 dest: '<%= yeoman.dist %>',
247 js: ['concat', 'uglifyjs'],
256 // Performs rewrites based on filerev and the useminPrepare configuration
258 html: ['<%= yeoman.dist %>/{,*/}*.html'],
259 css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
260 js: ['<%= yeoman.dist %>/scripts/{,*/}*.js'],
263 '<%= yeoman.dist %>',
264 '<%= yeoman.dist %>/images',
265 '<%= yeoman.dist %>/styles'
269 [/(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'
316 cwd: '<%= yeoman.app %>/images',
318 dest: '<%= yeoman.dist %>/images'
326 collapseWhitespace: true,
327 conservativeCollapse: true,
328 collapseBooleanAttributes: true,
329 removeCommentsFromCDATA: true
333 cwd: '<%= yeoman.dist %>',
335 dest: '<%= yeoman.dist %>'
343 module: 'yardStickGui2App',
344 htmlmin: '<%= htmlmin.dist.options %>',
345 usemin: 'scripts/scripts.js'
347 cwd: '<%= yeoman.app %>',
348 src: 'views/{,*/}*.html',
349 dest: '.tmp/templateCache.js'
353 // ng-annotate tries to make the code safe for minification automatically
354 // by using the Angular long form for dependency injection.
359 cwd: '.tmp/concat/scripts',
361 dest: '.tmp/concat/scripts'
366 // Replace Google CDN references
369 html: ['<%= yeoman.dist %>/*.html']
373 // Copies remaining files to places other tasks can use
379 cwd: '<%= yeoman.app %>',
380 dest: '<%= yeoman.dist %>',
384 'images/{,*/}*.{webp}',
385 'styles/fonts/{,*/}*.*'
390 dest: '<%= yeoman.dist %>/images',
394 cwd: 'bower_components/bootstrap/dist',
396 dest: '<%= yeoman.dist %>'
400 cwd: 'bower_components/components-font-awesome',
402 dest: '<%=yeoman.dist%>'
408 cwd: '<%= yeoman.app %>/styles',
409 dest: '.tmp/styles/',
414 // Run some tasks in parallel to speed up the build process
432 configFile: 'test/karma.conf.js',
439 grunt.registerTask('serve', 'Compile then start a connect web server', function(target) {
440 if (target === 'dist') {
441 return grunt.task.run(['build', 'connect:dist:keepalive']);
449 'connect:livereload',
454 grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function(target) {
455 grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
456 grunt.task.run(['serve:' + target]);
459 grunt.registerTask('test', [
468 grunt.registerTask('build', [
486 grunt.registerTask('default', [