performance - 为什么是 storeConfigInMeta : false not the default in Ember CLI?

标签 performance ember.js configuration ember-cli

来自 http://ember-cli.com/user-guide/ :

Application configurations from your ember-cli-build.js file will be stored inside a special meta tag in dist/index.html.

sample meta tag:

<meta name="user/config/environment" content="%7B%22modulePre.your.config">

This meta tag is required for your ember application to function properly. If you prefer to have this tag be part of your compiled javascript files instead, you may use the storeConfigInMeta flag in ember-cli-build.js.

// ember-cli-build.js
var app = new EmberApp({
  storeConfigInMeta: false
});


在生产中,这个元标签看起来像
<meta name="app/config/environment" content="%7B%22modulePrefix%22%3A%app%22%2C%22environment%22%3A%22production%22%2C%22baseURL%22%3A%22/%22%2C%22locationType%22...

并且很长。将配置对象作为 Javascript Assets 的一部分,而不是要求应用程序在启动后解析所有文本,不是更高效吗?

最佳答案

通过将其置于 JS 负载外部,可以更改元标记以配置 JS 应用程序,而无需重新编译应用程序。它在某些情况下非常有用......

关于performance - 为什么是 storeConfigInMeta : false not the default in Ember CLI?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37323756/

相关文章:

SQL 比较两个日期的最快方法(非标准 varchar 格式和日期时间)

mysql - 配置 Django 以使用远程 mysql 服务器?

sql-server - 如何根据作业名称批量更新 SQL Server 代理作业重试尝试

css - @font-face 带有多个字体大小的 css 声明会使 Firefox 缓慢爬行

r - 循环内的哪个函数效率更高(ncol/nrow() 或 dim())

c# - 如何提高反序列化速度?

ember.js - Ember JS 访问 ember 对象属性的首选方式

devise - 创建带有实时验证的 Ember 表单的最佳实践是什么?

javascript - Ember.js:查看按键事件监听

apache - 在 Apache 服务器上安装了 SSL,页面没有响应