@@ -65,28 +65,29 @@ gulp.task('vendor:assets', function () {
6565// ==================
6666
6767// Cache AngularJS templates
68- var fnHtml2Js = function ( path ) {
68+ var fnCacheTpls = function ( path ) {
6969 return gulp . src ( path )
7070 . pipe ( plugins . minifyHtml ( {
7171 empty : true ,
7272 spare : true ,
7373 quotes : true
7474 } ) )
75- . pipe ( plugins . ngHtml2js ( {
76- moduleName : 'templates'
75+ . pipe ( plugins . angularTemplatecache ( {
76+ module : 'ngDevstack.templates' ,
77+ standalone : true
7778 } ) )
78- . pipe ( plugins . concat ( 'app- templates.js' ) )
79+ . pipe ( plugins . concat ( 'templates.js' ) )
7980 . pipe ( gulp . dest ( config . build + '/app' ) ) ;
8081} ;
81- gulp . task ( 'scripts:html2js ' , function ( ) {
82- return fnHtml2Js ( config . paths . templates ) ;
82+ gulp . task ( 'scripts:cacheTpls ' , function ( ) {
83+ return fnCacheTpls ( config . paths . templates ) ;
8384} ) ;
8485
8586// Check JavaScript code quality with JSHint
8687var fnLint = function ( path ) {
8788 return gulp . src ( path , { base : config . app } )
8889 . pipe ( plugins . plumber ( ) )
89- . pipe ( plugins . jshint ( '.jshintrc' ) )
90+ . pipe ( plugins . jshint ( ) )
9091 . pipe ( plugins . jshint . reporter ( 'default' ) )
9192 . pipe ( gulp . dest ( config . build ) ) ;
9293} ;
@@ -95,14 +96,14 @@ gulp.task('scripts:lint', function () {
9596} ) ;
9697
9798// Concat and minify JavaScript
98- gulp . task ( 'scripts' , [ 'scripts:lint' , 'scripts:html2js ' , 'vendor:js' ] , function ( ) {
99- var arr = ( config . vendor_files . js ) . concat ( config . paths . scripts ) ;
99+ gulp . task ( 'scripts' , [ 'scripts:lint' , 'scripts:cacheTpls ' , 'vendor:js' ] , function ( ) {
100+ var arr = ( config . vendor_files . js ) . concat ( config . paths . scripts , config . build + '/app/templates.js' ) ;
100101 return gulp . src ( arr )
101102 . pipe ( plugins . concat ( 'main.js' ) )
102103 . pipe ( plugins . bytediff . start ( ) )
103104 . pipe ( plugins . ngmin ( ) )
104- . pipe ( plugins . uglify ( ) )
105105 . pipe ( plugins . removelogs ( ) )
106+ . pipe ( plugins . uglify ( ) )
106107 . pipe ( plugins . rename ( { suffix : '.min' } ) )
107108 . pipe ( plugins . bytediff . stop ( ) )
108109 . pipe ( gulp . dest ( config . dist + '/assets' ) ) ;
@@ -153,7 +154,7 @@ var fnInject = function (path) {
153154 } ) )
154155 . pipe ( gulp . dest ( config . build ) ) ;
155156} ;
156- gulp . task ( 'html:inject' , [ 'styles:sass' , 'scripts:lint' , 'scripts:html2js ' ] , function ( ) {
157+ gulp . task ( 'html:inject' , [ 'styles:sass' , 'scripts:lint' , 'scripts:cacheTpls ' ] , function ( ) {
157158 return fnInject ( config . paths . html ) ;
158159} ) ;
159160
@@ -209,7 +210,7 @@ gulp.task('test:watch', ['vendor:assets'], function() {
209210// ============
210211
211212// Add files to Watch
212- gulp . task ( 'watch' , [ 'styles:sass' , 'scripts:lint' , 'scripts:html2js ' , 'assets:img' , 'vendor:js' , 'vendor:assets' , 'test:watch' , 'html:inject' ] , function ( ) {
213+ gulp . task ( 'watch' , [ 'styles:sass' , 'scripts:lint' , 'scripts:cacheTpls ' , 'assets:img' , 'vendor:js' , 'vendor:assets' , 'test:watch' , 'html:inject' ] , function ( ) {
213214 require ( './server.js' ) ( server ) ;
214215
215216 // watch for JS changes
@@ -235,7 +236,7 @@ gulp.task('watch', ['styles:sass', 'scripts:lint', 'scripts:html2js', 'assets:im
235236 // watch AngularJS templates to cache
236237 gulp . watch ( config . app + '/+(app|common)/**' , function ( event ) {
237238 if ( event . path . lastIndexOf ( '.tpl.html' ) === event . path . length - 9 ) {
238- return fnHtml2Js ( config . paths . templates ) . pipe ( plugins . livereload ( server ) ) ;
239+ return fnCacheTpls ( config . paths . templates ) . pipe ( plugins . livereload ( server ) ) ;
239240 }
240241 } ) ;
241242
@@ -281,7 +282,7 @@ gulp.task('clean', function () {
281282// ===============
282283
283284gulp . task ( 'build' , [ 'clean' ] , function ( ) {
284- gulp . start ( 'styles:sass' , 'scripts:lint' , 'scripts:html2js ' , 'vendor:js' , 'vendor:assets' , 'test:run' , 'assets:img' , 'html:inject' ) ;
285+ gulp . start ( 'styles:sass' , 'scripts:lint' , 'scripts:cacheTpls ' , 'vendor:js' , 'vendor:assets' , 'test:run' , 'assets:img' , 'html:inject' ) ;
285286} ) ;
286287
287288gulp . task ( 'compile' , [ 'build' ] , function ( ) {
0 commit comments