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

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

问题描述

我正在使用 ember-cli 来构建我的应用程序.

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

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

It compiles all the files to the dist/ directory.

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

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">

这是我的部署的一个问题,因为我目前正在另一个页面中使用 ember-app,并且这个元标记是 ember 应用程序运行所必需的.有没有办法将它作为 javascript 编译文件的一部分或完全摆脱它?

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?

推荐答案

最近在 这个公关

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

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();

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

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

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

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