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

Option to change default template location

Open fgarcia opened this issue 11 years ago • 2 comments

So far I must load my templates like this:

// In App file:
require(['jquery','hbs!/assets/templates/contact/phone'], 

// In main require file:
  hbs: {
    disableI18n: true,
    partialsUrl: '/assets/templates'  
  }

However, even if set partialsUrl: '/assets/templates' the following line fails:

require(['jquery','hbs!contact/phone'], 

The above line (instead full path), searches from hbs folder:

GET (0.0012s) /assets/vendors/contact/phone.hbs - 404 Not Found

I do not seem to find an option to change the base template Url. Having one would save lots of typing.

fgarcia avatar Feb 02 '14 19:02 fgarcia

I faced same problem when url starts with '/'. If url starts with './' actually start from the current template directory and look for the partial. I used it as a work-around as template configure is working. You can configure templates directory from

paths: templates: '../templates' 

if you want to be outside JS dir.

LynxDelli avatar Feb 19 '14 14:02 LynxDelli

I had a similar problem unable to load templates from a mocha test running with karma. Adding paths to karma require config solved it. Thanks.

danielabar avatar Aug 05 '14 23:08 danielabar