[ember-cli] storeConfigInMeta - why?


#1

Hi there,

I’ve been reading the docs about the storeConfigInMeta (http://www.ember-cli.com/user-guide/#application-configuration), and I must say I am confused:

The doc states “This meta tag is required for your ember application to function properly”, but I see no difference when switching the value. Can someone elaborate?

I am fairly confident that there are good reasons for this meta tag, but it is, in my naive opinion, somewhat fishy. Can some provide with a bit of context about how/why it has emerged as a necessity to store the config in a meta tag, please?

And, last but not least, is it here to stay? Are there alternatives?

Thanks for reading!


#2

The tag contains compiled info from your config/environment.js.

It’s definitely here to stay. As the doc says, storeConfigInMeta is a switch for you to choose whether to store this information as a meta tag or prepend it to your JavaScript file.

The configuration determines a lot of things, including environment info that your app is going to run in (development vs production). It also contains information regarding Ember features behind feature flag. This piece of info, whether to load it through meta tag or JavaScript, needs to be the FIRST to be loaded. Here’s the order.

  1. Load config
  2. Load Ember framework and other libraries
  3. Load your application and boot it.

Since the config is a very small piece of information, it make sense to just bundle it with index.html than going through another request round trip.


#3

I can’t say why you need to store in the the meta tag, I don’t think you ever would need to because setting this value to false will bundle the configuration object in your app.js file.

I flip it to false places where I don’t actually serve up ember-cli’s index.html. Instead, need to serve up my application from a rails server and only care about the javascript assets for the ember app.


#4

@lightblade Thanks for the info; please note that I am not questioning the necessity of the config, but the choice of the meta tag as its default location.

@jasonmit We’re pretty much in the same situation. I always set it to false because in the end, I won’t use the generated index.html. As long as there’s no incidence on the app, I prefer to scrap any ember-specifics out of the (non-js) code, hence removing the meta tag.