File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -171,8 +171,8 @@ function templateCache(filename, options) {
171171 * Prepare header / footer
172172 */
173173
174- var templateHeader = options . templateHeader || TEMPLATE_HEADER ;
175- var templateFooter = options . templateFooter || TEMPLATE_FOOTER ;
174+ var templateHeader = 'templateHeader' in options ? options . templateHeader : TEMPLATE_HEADER ;
175+ var templateFooter = 'templateFooter' in options ? options . templateFooter : TEMPLATE_FOOTER ;
176176
177177 /**
178178 * Build templateCache
Original file line number Diff line number Diff line change @@ -412,6 +412,27 @@ describe('gulp-angular-templatecache', function () {
412412 stream . end ( ) ;
413413 } ) ;
414414
415+ it ( 'should accept empty strings as header and footer' , function ( cb ) {
416+ var stream = templateCache ( 'templates.js' , {
417+ templateHeader : '' ,
418+ templateFooter : ''
419+ } ) ;
420+
421+ stream . on ( 'data' , function ( file ) { assert
422+ assert . equal ( file . path , path . normalize ( __dirname + '/templates.js' ) ) ;
423+ assert . equal ( file . relative , 'templates.js' ) ;
424+ assert . equal ( file . contents . toString ( 'utf8' ) , '$templateCache.put(\'/template-a.html\',\'yoo\');' ) ;
425+ cb ( ) ;
426+ } ) ;
427+
428+ stream . write ( new Vinyl ( {
429+ base : __dirname ,
430+ path : __dirname + '/template-a.html' ,
431+ contents : new Buffer ( 'yoo' )
432+ } ) ) ;
433+
434+ stream . end ( ) ;
435+ } ) ;
415436 } ) ;
416437
417438 describe ( 'options.templateBody' , function ( ) {
You can’t perform that action at this time.
0 commit comments