Animal Rights
Animal Rights

Reputation: 9377

how to tell ember-cli to build using another file other than app/index.html

Is there a way to tell ember cli to use another HTML file for building instead of app/index.html? I have an in-app-addon and Im not sure how to find that information. Thanks!

Upvotes: 0

Views: 524

Answers (1)

Nicolai Dahl
Nicolai Dahl

Reputation: 269

I fiddled around with this for quite a while and ended up with a solution that avoids multiple index.html files alltogether, as I couldn't find a good way to tell ember-cli to use an index file of my choice.

I used ember-cli-inline-content to customize the content of index.html based on the current configuration.

You basically add {{content-for "key1"}} where you need environment-specific code to be inserted into the index file.

As you can read in the documentation for ember-cli-inline-content, the configuration for "key1" goes in the ember-cli-build.js file.

As an aside: If you need to access your ENV object from config/environment.js you can do it like so:

var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var ENV = require('./config/environment')(EmberApp.env());

Hope that helps

Upvotes: 2

Related Questions