窥视ember-cli(EmberApp):vendor.js和app.js

时间:2015-06-22 16:22:01

标签: ember.js ember-cli broccolijs

使用优秀的broccoli-stew,我可以查看导出的应用程序树:

/* global require, module */

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

var log   = require('broccoli-stew').log;
var debug = require('broccoli-stew').debug;

var app = new EmberApp();

// Use `app.import` to add additional libraries to the generated
// output files.
//
// If you need to use different assets in different
// environments, specify an object as the first parameter. That
// object's keys should be the environment name and the values
// should be the asset to use in that environment.
//
// If the library that you are including contains AMD or ES6
// modules that you would like to import into your application
// please specify an object with the list of modules as keys
// along with the exports of each module as its value.

app.import('bower_components/ember-i18n/lib/i18n.js');
app.import('bower_components/raphael/raphael.js');

var finalTree = log(app.toTree());

module.exports = finalTree;

有了这个,我得到了一个非常干净的树形输出我的应用程序:

[ 'assets/app.js',
  'assets/app.map',
  'assets/app.scss',
  ...
  'assets/vendor.css',
  'assets/vendor.js',
  'assets/vendor.map',
  'crossdomain.xml',
  'index.html',
  'robots.txt',
  'testem.js',
  'tests/index.html' ]

我在那个树中看到,除了其他文件之外,我们还有一个vendor.js和一个app.js模块(如预期的那样),但我不知道每个模块中放入了哪些包。< / p>

我觉得我在前端错过了一个(在这种情况下,raphael.js),所以我想验证ember-cli(通过EmberApp)确实做了什么我要求(即包括raphael.js,可能在vendor.js

直接查看app.jsvendor.js是不可行的(太大/不知道要查找什么)。我想要一个简单的树状显示文件,EmberApp已包含在vendor.js / app.js中,与broccoli-stew提供的格式相同(相似)。

这可能吗?怎么样?

1 个答案:

答案 0 :(得分:-1)

引用http://www.ember-cli.com/asset-compilation/#configuring-output-paths

Assets                                          Output File
JavaScript files you import with app.import()   /assets/vendor.js

所以虽然这不是一个很好的树视图,但你应该没问题: - )