ember-cli元配置/环境文件 [英] ember-cli meta config/environment file

查看:108
本文介绍了ember-cli元配置/环境文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ember-cli来构造我的应用程序。



它将所有文件编译到 dist / 目录。



但是,当我检查编译的 index.html 时,我注意到它正在创建这个元标记。

 < meta name =user / config / environmentcontent =%7B%22modulePrefix%22%3A%22user% 22%2C%22environment%22%3A%22development%22%2C%22baseURL%22%3A%22 /%22%2C%22locationType%22%3A%22auto%22%2C%22contentSecurityPolicy%22%3A%7B%22default -src%22%3A%22%27none%27%20localhost%22%2C%22script-src的%22%3A%22%27self%27%20%27unsafe列直插%27%20%27unsafe-EVAL%27%20use .typekit.net%20connect.facebook.net%20maps.googleapis.com%20maps.gstatic.com%22%2C%22font-src的%22%3A%22%27self%27%20data%3A%20use.typekit.net %22%2C%22connect-src的%22%3A%22%27self%27%20localhost%22%2C%22img-src的%22%3A%22%27self%27%20www.facebook.com%20p.typekit.net %22%2C%22style-src的%22%3A%22%27self%27%20%27unsafe列直插%27%20use.typekit.net%22%2C%22frame-src的%22%3A%22S-static.ak 。 facebook.com%20static.ak.facebook.com%20www.facebook.com%22%7D%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%7D%2C%22APP%22% 3A%7B%22LOG_ACTIVE_GENERATION%22%3Atrue%2C%22LOG_VIEW_LOOKUPS%22%3Atrue%7D%2C%22exportApplicationGlobal%22%3Atrue%7D> 

这是我的部署问题,因为我正在另一个页面中使用ember应用程序,这个元标记是ember应用程序工作所必需的。有没有办法将其作为javascript编译文件的一部分或完全摆脱?

解决方案

构建能力您没有这个的应用最近已添加到此PR



通过传递 storeConfigInMeta 选项可以将其设置为编译的JS输出。要选择退出,它应该在您的 Brocfile.js

  / * global require,module * / 

var EmberApp = require('ember-cli / lib / broccoli / ember-app');

var app = new EmberApp({
storeConfigInMeta:false
});

module.exports = app.toTree();

这是在ember-cli 0.1.2中可用的,现在是最新版本


I'm using ember-cli to structure my app.

It compiles all the files to the dist/ directory.

However as I inspected the compiled index.html I noticed it was creating this meta tag.

<meta name="user/config/environment" content="%7B%22modulePrefix%22%3A%22user%22%2C%22environment%22%3A%22development%22%2C%22baseURL%22%3A%22/%22%2C%22locationType%22%3A%22auto%22%2C%22contentSecurityPolicy%22%3A%7B%22default-src%22%3A%22%27none%27%20localhost%22%2C%22script-src%22%3A%22%27self%27%20%27unsafe-inline%27%20%27unsafe-eval%27%20use.typekit.net%20connect.facebook.net%20maps.googleapis.com%20maps.gstatic.com%22%2C%22font-src%22%3A%22%27self%27%20data%3A%20use.typekit.net%22%2C%22connect-src%22%3A%22%27self%27%20localhost%22%2C%22img-src%22%3A%22%27self%27%20www.facebook.com%20p.typekit.net%22%2C%22style-src%22%3A%22%27self%27%20%27unsafe-inline%27%20use.typekit.net%22%2C%22frame-src%22%3A%22s-static.ak.facebook.com%20static.ak.facebook.com%20www.facebook.com%22%7D%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%7D%2C%22APP%22%3A%7B%22LOG_ACTIVE_GENERATION%22%3Atrue%2C%22LOG_VIEW_LOOKUPS%22%3Atrue%7D%2C%22exportApplicationGlobal%22%3Atrue%7D">

This is a problem for my deployment as I'm currently using the ember-app within another page and this meta tag is needed for the ember app to work. Is there a way to make this as part of the javascript compiled file or get rid of this altogether?

解决方案

The ability to build your app without this was recently added in this PR

You can set it up to be in your compiled JS output by passing in the storeConfigInMeta option. To opt-out, it should look like this in your Brocfile.js

/* global require, module */

var EmberApp = require('ember-cli/lib/broccoli/ember-app');

var app = new EmberApp({
  storeConfigInMeta: false
});

module.exports = app.toTree();

This is available in ember-cli 0.1.2 which is the latest version right now

这篇关于ember-cli元配置/环境文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆