Skip to content


Subversion checkout URL

You can clone with
Download ZIP


I don't understand the base option #14

drewhamlett opened this Issue · 10 comments

3 participants


If I have a config like this

ngtemplates: {
            'templates': {
                options: {
                    base: 'partials/'
                src: ['build/tmp/partials/*.html'],
                dest: 'build/js/templates.js'

I need the reference to the partials to be partials/home.html because that's the way my code is written.

Instead I get references like this build/tmp/partials/home.html . I've tried every base configuration I can think of.

I'm copying all the templates over when I minify the html so that's why it's in tmp directory.

When I think of base I don't think of a relative physical base path. I think of a string version of the path the html should be under.

I shouldn't be able to put things like '../../' for base and get a physical path. That would never make sense.


Let's say you have your public directory mapped using express. You load partials from /partials/home.html . When you go to do your build, all your template cache paths are public/partials/home.html because they are under the public directory. You should be able to say /partials.


Try settings the base to build/tmp. Think of base as the portion of the path you want to strip from it.

Also, I'm doing something very similar to your setup :)

If your project is open-source, I'd <3 to send you a PR and get it working!


Thanks man! And for the fast reply. This was driving me crazy. Not open source sadly, I'm using it at my company for an iPhone app we're doing.


For my site, I need and extra option for prepending some string to the resulting path so i can do this:

options: {
base: '../..',
pathPrepend: '/static/'

relative path to the template: ../../assets/template1.html
output id: assets/template1.html
desired output id: /static/assets/template1.html (note the /static/ in the begginning)

I have made some changes to your code to make this work. May I send it for your review?


Totally! Send off a PR!

One thing to keep in mind is that, the plugin is meant to pre-load templates that would be able to resolve otherwise via XHR.

It would be bad practice, IMO, to require compilation & concatenation of templates that would otherwise not be web-accessible (as a fall-back).


Indeed they're accesible. Templates are served by a django app. They use an absolute URI scheme that works right in "single file mode". The problem is the deployment system. It is not located on the project root and using the "base" option generates ids without the beginning / that is present in the non-templatecached app. I will send a PR, but i need to know how to do it first...


Ah, don't sweat it. If you can do me a favor & create a new issue just for tracking, I'll take care of it! :)

(This issue was already tracked + closed)


Wait, nevermind, I'll just use this one! :D

@ericclemmons ericclemmons reopened this

Just made a PR. I was easier than I though :)


Closing this again, just because I like the activity :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.