Allowing templates to be in seperate files


#1

Hi, as far as I know… There is no way to tell Ember (or let it find it on it’s own) that a handlebars template is on another file on the server, and let Ember get it via Ajax or something if needed.

Is this intentional? If not will this be supported?

(All this is assuming I’m correct - which I’m not sure of :wink: )

Thanks, Jason


#2

At my company we have all of our templates in different files and bundle them on deploy. Depending on what your server architecture is there are multiple solutions for the bundling of handlebar templates.

My companies backend is .net and we’re using Myslik’s bundler


#3

I see, Those are the types of answers I found. But is something I’d prefer to avoid. I think it would be much nicer if I could just put a file with the templates name - And Voilla! done.


#4

Check what we did in http://www.asp.net/single-page-application/overview/templates/emberjs-template


#5

Intresting, thanks.

How do you handle dependencies there? Since you add files by *.js for example: what if my controller depends on a view and so and so…


#6

If you have dependencies or need dependency orders on the script and js files, you should use separate bundles and include them differently on page. i.e. change App_Start/BundleConfig.cs in the example. And change App.cshtml’s Script render accordingly on the server page you have.