我是新来的。但是对于特定的任务,我需要更改模板的输入路径以进行编译。即默认是app / templates。但我想改变这条道路。 我已经阅读了ember-cli-build.js文件,但我只能编辑输出路径。我该如何编辑输入路径。 我的ember-cli-build.js
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
var app = new EmberApp(defaults, {
// Add options here
outputPaths: {
app: {
html: 'ember_build_index.html'
}
}
});
// 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/bootstrap/dist/js/bootstrap.min.js');
app.import('bower_components/bootstrap/dist/css/bootstrap.min.css');
app.import('bower_components/bootstrap/dist/css/bootstrap.css.map');
return app.toTree();
};
答案 0 :(得分:3)
您必须更改正在构建的ember应用程序的模板目录路径。
要检查当前模板目录路径,请使用console.log(app.trees.templates._directoryPath)将其登录到控制台,检查ember-cli-build.js中的app.trees.templates._directoryPath。
现在,如果您希望您的ember构建包含来自'app / templates / mobile'的模板(在您的情况下),只需更改: app.trees.templates._directoryPath ='app / templates / mobile'在ember-cli-build.js中返回app.toTree();
构造模板树的node_module位于第0行的'node_modules / ember-cli / lib / broccoli / ember-app.js'。 724,它访问'this.trees.templates',其中这是你的应用程序的实例。