require-handlebars-plugin icon indicating copy to clipboard operation
require-handlebars-plugin copied to clipboard

hi

Open jumplee opened this issue 11 years ago • 0 comments

I don't know why partialsUrl isn't work I use requirejs baseUrl to use the js file from cdn code

baseUrl:'http://cdn.com/static/js',
hbs:{
partialsUrl:'./'
}

how could I get template file in my server?becouse the cross-domain issue,I can't upload the template file on the cdn server.

function getBasePath(){
    var base=location.href;
    var m=new RegExp('^http://[^?]*/');
    var arr=m.exec(base);
    if(arr.length>0){
        return arr[0];
    }else{
      return '';
    }

}

I use this function to get the location of the html file,and add a path

paths:{
tpl:getBasePath()+'tpl'
}

require(['hbs!tpl/table'],function(template){
...
})

Is there some better way to make it?

jumplee avatar Apr 16 '14 10:04 jumplee