File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ module.exports = function (assembler) {
5353 } ;
5454
5555 /**
56- * Load Partials/Templates
56+ * Load Partials/Templates
5757 * @param {Object } templates
5858 * @param {Function } callback
5959 */
@@ -95,7 +95,7 @@ module.exports = function (assembler) {
9595 * @return {Object }
9696 */
9797 self . loadTemplatesSync = function ( templates ) {
98- _ . each ( templates , function ( content , fileName ) {
98+ _ . each ( templates , function ( content , fileName ) {
9999 self . handlebars . templates [ fileName ] = self . handlebars . compile ( content , self . options ) ;
100100 } ) ;
101101
@@ -138,6 +138,16 @@ module.exports = function (assembler) {
138138 return path ;
139139 }
140140
141+ if ( path . substr ( 0 , 7 ) === 'webdav:' ) {
142+ path = path . slice ( 7 , path . length ) ;
143+
144+ if ( path [ 0 ] === '/' ) {
145+ path = path . slice ( 1 , path . length ) ;
146+ }
147+
148+ return [ cdnUrl , 'content' , path ] . join ( '/' ) ;
149+ }
150+
141151 if ( path [ 0 ] !== '/' ) {
142152 path = '/' + path ;
143153 }
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ describe('cdn helper', function() {
1717 theme_version_id : '123' ,
1818 theme_config_id : '3245' ,
1919 }
20- }
20+ } ;
2121
2222 it ( 'should render the css cdn url' , function ( done ) {
2323 expect ( c ( '{{cdn "assets/css/style.css"}}' , context ) )
@@ -70,4 +70,15 @@ describe('cdn helper', function() {
7070
7171 done ( ) ;
7272 } ) ;
73+
74+ it ( 'should return a webDav asset if webdav protocol specified' , function ( done ) {
75+
76+ expect ( c ( '{{cdn "webdav:img/image.jpg"}}' , context ) )
77+ . to . be . equal ( 'https://cdn.bcapp/3dsf74g/content/img/image.jpg' ) ;
78+
79+ expect ( c ( '{{cdn "webdav:/img/image.jpg"}}' , context ) )
80+ . to . be . equal ( 'https://cdn.bcapp/3dsf74g/content/img/image.jpg' ) ;
81+
82+ done ( ) ;
83+ } ) ;
7384} ) ;
You can’t perform that action at this time.
0 commit comments