Bil*_*ull 10 ember.js ember-cli broccolijs ember-cli-addons
我正在开发一个ember-cli项目,我正在开发一个系统,允许我解析尚未加载的模板,并且可能存在于项目结构之外.
我想在我的dist/assets目录中调用一个文件夹templates,在该文件夹中将是所有预编译的模板app/templates/external.这是我目前Brocfile.js用西兰花炖的尝试
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var stew = require("broccoli-stew");
var app = new EmberApp({
vendorFiles: {
"jquery.js": null
},
sassOptions: {
includePaths: [
'bower_components/bourbon/app/assets/stylesheets/',
'bower_components/neat/app/assets/stylesheets/',
'bower_components/bitters/app/assets/stylesheets/'
]
}
});
var additionalTrees = [];
var templateFiles = stew.find(appTree, "assets/app/templates/external");
templateFiles = stew.mv(templateFiles, "assets/app/templates/external", "assets/templates");
additionalTrees.push(templateFiles);
module.exports = app.toTree(additionalTrees);
Run Code Online (Sandbox Code Playgroud)
有一个名为broccoli-file-mover的 npm 包,易于使用,可以在这里找到
使用方法非常简单,如下所示:
moveFile(输入树,选项)
可用于移动文件(多个或单个)或整个文件夹
例子 :
将单个文件从 app/main 移动到 app:
var moveFile = require('broccoli-file-mover');
var tree = moveFile('app', {
srcFile: 'app/main.js',
destFile: '/app.js'
});
Run Code Online (Sandbox Code Playgroud)
将 app/main 移动到 app 并将 test/main 移动到测试:
var moveFile = require('broccoli-file-mover');
var tree = moveFile('app', {
files: {
'app/main.js': 'app.js',
'test/main.js': 'test.js'
}
});
Run Code Online (Sandbox Code Playgroud)
另外,在 blessnm 之前评论 broccoli funnel 是一个可能的解决方案,因为您可以将目录复制到您想要的任何位置(认为问题说明正在移动,但认为复制可能是一个可接受的解决方案),这里是插件的存储库。
| 归档时间: |
|
| 查看次数: |
582 次 |
| 最近记录: |