@@ -22,38 +22,33 @@ module.exports = function (grunt) {
2222 yeoman : {
2323 // configurable paths
2424 app : require ( './bower.json' ) . appPath || 'app' ,
25- dist : 'dist '
25+ dist : 'web-app '
2626 } ,
2727
2828 // Watches files for changes and runs tasks based on the changed files
2929 watch : {
3030 js : {
31- files : [ '<%= yeoman.app %>/scripts/{,*/}*.js' ] ,
32- tasks : [ 'newer:jshint:all' ] ,
33- options : {
34- livereload : true
35- }
31+ files : [ '<%= yeoman.app %>/scripts/**/{,*/}*.js' ] ,
32+ tasks : [ 'useminPrepare' ,
33+ 'concat' ,
34+ 'copy:scripts' ]
35+ } ,
36+ html : {
37+ files : [ '<%= yeoman.app %>/views/**/{,*/}*.html' ] ,
38+ tasks : [ 'newer:copy:view' ]
3639 } ,
3740 jsTest : {
3841 files : [ 'test/spec/{,*/}*.js' ] ,
3942 tasks : [ 'newer:jshint:test' , 'karma' ]
4043 } ,
41- styles : {
42- files : [ '<%= yeoman.app %>/styles/{,*/}*.css' ] ,
43- tasks : [ 'newer:copy:styles' , 'autoprefixer' ]
44- } ,
4544 gruntfile : {
4645 files : [ 'Gruntfile.js' ]
4746 } ,
4847 livereload : {
4948 options : {
5049 livereload : '<%= connect.options.livereload %>'
5150 } ,
52- files : [
53- '<%= yeoman.app %>/{,*/}*.html' ,
54- '.tmp/styles/{,*/}*.css' ,
55- '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
56- ]
51+ files : [ '<%= yeoman.dist %>/**/*' ]
5752 }
5853 } ,
5954
@@ -116,29 +111,14 @@ module.exports = function (grunt) {
116111 dot : true ,
117112 src : [
118113 '.tmp' ,
119- '<%= yeoman.dist %>/* ' ,
120- '! <%= yeoman.dist %>/.git* '
114+ '<%= yeoman.dist %>/scripts ' ,
115+ '<%= yeoman.dist %>/views '
121116 ]
122117 } ]
123118 } ,
124119 server : '.tmp'
125120 } ,
126121
127- // Add vendor prefixed styles
128- autoprefixer : {
129- options : {
130- browsers : [ 'last 1 version' ]
131- } ,
132- dist : {
133- files : [ {
134- expand : true ,
135- cwd : '.tmp/styles/' ,
136- src : '{,*/}*.css' ,
137- dest : '.tmp/styles/'
138- } ]
139- }
140- } ,
141-
142122 // Automatically inject Bower components into the app
143123 'bower-install' : {
144124 app : {
@@ -147,24 +127,6 @@ module.exports = function (grunt) {
147127 }
148128 } ,
149129
150-
151-
152-
153-
154- // Renames files for browser caching purposes
155- rev : {
156- dist : {
157- files : {
158- src : [
159- '<%= yeoman.dist %>/scripts/{,*/}*.js' ,
160- '<%= yeoman.dist %>/styles/{,*/}*.css' ,
161- '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}' ,
162- '<%= yeoman.dist %>/styles/fonts/*'
163- ]
164- }
165- }
166- } ,
167-
168130 // Reads HTML for usemin blocks to enable smart builds that automatically
169131 // concat, minify and revision files. Creates configurations in memory so
170132 // additional tasks can operate on them
@@ -175,36 +137,7 @@ module.exports = function (grunt) {
175137 }
176138 } ,
177139
178- // Performs rewrites based on rev and the useminPrepare configuration
179- usemin : {
180- html : [ '<%= yeoman.dist %>/{,*/}*.html' ] ,
181- css : [ '<%= yeoman.dist %>/styles/{,*/}*.css' ] ,
182- options : {
183- assetsDirs : [ '<%= yeoman.dist %>' ]
184- }
185- } ,
186-
187140 // The following *-min tasks produce minified files in the dist folder
188- imagemin : {
189- dist : {
190- files : [ {
191- expand : true ,
192- cwd : '<%= yeoman.app %>/images' ,
193- src : '{,*/}*.{png,jpg,jpeg,gif}' ,
194- dest : '<%= yeoman.dist %>/images'
195- } ]
196- }
197- } ,
198- svgmin : {
199- dist : {
200- files : [ {
201- expand : true ,
202- cwd : '<%= yeoman.app %>/images' ,
203- src : '{,*/}*.svg' ,
204- dest : '<%= yeoman.dist %>/images'
205- } ]
206- }
207- } ,
208141 htmlmin : {
209142 dist : {
210143 options : {
@@ -235,86 +168,28 @@ module.exports = function (grunt) {
235168 }
236169 } ,
237170
238- // Replace Google CDN references
239- cdnify : {
240- dist : {
241- html : [ '<%= yeoman.dist %>/*.html' ]
242- }
243- } ,
244-
245171 // Copies remaining files to places other tasks can use
246172 copy : {
247- dist : {
173+ view : {
248174 files : [ {
249175 expand : true ,
250176 dot : true ,
251177 cwd : '<%= yeoman.app %>' ,
252178 dest : '<%= yeoman.dist %>' ,
253- src : [
254- '*.{ico,png,txt}' ,
255- '.htaccess' ,
256- '*.html' ,
257- 'views/{,*/}*.html' ,
258- 'bower_components/**/*' ,
259- 'images/{,*/}*.{webp}' ,
260- 'fonts/*'
261- ]
262- } , {
263- expand : true ,
264- cwd : '.tmp/images' ,
265- dest : '<%= yeoman.dist %>/images' ,
266- src : [ 'generated/*' ]
179+ src : [ 'views/{,*/}*.html' ]
267180 } ]
268181 } ,
269- styles : {
270- expand : true ,
271- cwd : '<%= yeoman.app %>/styles' ,
272- dest : '.tmp/styles/' ,
273- src : '{,*/}*.css'
182+ scripts : { // no minification of js used for dev mode
183+ files : [ {
184+ expand : true ,
185+ dot : true ,
186+ cwd : '.tmp/concat' ,
187+ dest : '<%= yeoman.dist %>' ,
188+ src : [ 'scripts/scripts.js' ]
189+ } ]
274190 }
275191 } ,
276192
277- // Run some tasks in parallel to speed up the build process
278- concurrent : {
279- server : [
280- 'copy:styles'
281- ] ,
282- test : [
283- 'copy:styles'
284- ] ,
285- dist : [
286- 'copy:styles' ,
287- 'imagemin' ,
288- 'svgmin'
289- ]
290- } ,
291-
292- // By default, your `index.html`'s <!-- Usemin block --> will take care of
293- // minification. These next options are pre-configured if you do not wish
294- // to use the Usemin blocks.
295- // cssmin: {
296- // dist: {
297- // files: {
298- // '<%= yeoman.dist %>/styles/main.css': [
299- // '.tmp/styles/{,*/}*.css',
300- // '<%= yeoman.app %>/styles/{,*/}*.css'
301- // ]
302- // }
303- // }
304- // },
305- // uglify: {
306- // dist: {
307- // files: {
308- // '<%= yeoman.dist %>/scripts/scripts.js': [
309- // '<%= yeoman.dist %>/scripts/scripts.js'
310- // ]
311- // }
312- // }
313- // },
314- // concat: {
315- // dist: {}
316- // },
317-
318193 // Test settings
319194 karma : {
320195 unit : {
@@ -324,7 +199,6 @@ module.exports = function (grunt) {
324199 }
325200 } ) ;
326201
327-
328202 grunt . registerTask ( 'serve' , function ( target ) {
329203 if ( target === 'dist' ) {
330204 return grunt . task . run ( [ 'build' , 'connect:dist:keepalive' ] ) ;
@@ -333,8 +207,6 @@ module.exports = function (grunt) {
333207 grunt . task . run ( [
334208 'clean:server' ,
335209 'bower-install' ,
336- 'concurrent:server' ,
337- 'autoprefixer' ,
338210 'connect:livereload' ,
339211 'watch'
340212 ] ) ;
@@ -347,8 +219,6 @@ module.exports = function (grunt) {
347219
348220 grunt . registerTask ( 'test' , [
349221 'clean:server' ,
350- 'concurrent:test' ,
351- 'autoprefixer' ,
352222 'connect:test' ,
353223 'karma'
354224 ] ) ;
@@ -357,16 +227,10 @@ module.exports = function (grunt) {
357227 'clean:dist' ,
358228 'bower-install' ,
359229 'useminPrepare' ,
360- 'concurrent:dist' ,
361- 'autoprefixer' ,
362230 'concat' ,
363231 'ngmin' ,
364- 'copy:dist' ,
365- 'cdnify' ,
366- 'cssmin' ,
232+ 'copy:view' ,
367233 'uglify' ,
368- 'rev' ,
369- 'usemin' ,
370234 'htmlmin'
371235 ] ) ;
372236
0 commit comments