I’ve done this with on the old-router version of Ember (3 ember apps within the
templateName: "firstApp/templates/menu" and in another
template: "secondApp/templates/menu", assuming
secondApp are folders in
Nowadays, there’s a lot more of this that’s generated for you based on naming conventions, and if you want to have this work for multiple Ember apps in a Rails app, you’ll have to do some tweaking.
Here’s snippet of the directory structure I used in this older Ember app:
Ember.Application had its own app name and namespace
Landing. There was also an
Shared for model definitions, helpers, views, etc., shared between all the apps.
If I were to do this with the latest master, I think I would put the following in
application.rb (assuming you’re using
config.handlebars.templates_root = ["contributors_webapp/templates", "receivers/templates", "landing/templates", "shared/templates"]
The default value of
templates_root is “templates”, but that won’t work for us since we have the multiple apps. The above configuration will compile the template at
Ember.TEMPLATES["foo"]. Note that it would also compile the template at
Ember.TEMPLATES["foo"], resulting in a collision, but this is resolved by the fact that the giant
receivers.js bundle wouldn’t include the templates from
landing. The result of this is that regardless of which app you’re loading, your templates will be output according to Ember’s default naming conventions.
If for some reason this doesn’t work for you, there are things you could do within Ember to override the default naming conventions, specifically by overriding the
DefaultResolver. Check out the documentation for that here.