[英]Move Entire Folder using Broccoli JS in Ember CLI Project
I am developing an ember-cli
project and I am working on a system that allows me to resolve templates that have not been loaded and may possibly live outside of the project structure. 我正在开发一个ember-cli
项目,我正在开发一个系统,它允许我解析未加载的模板,并且可能存在于项目结构之外。
I would like to have a folder in my dist/assets
directory called templates
and inside that folder would be all the pre compiled templates from app/templates/external
. 我想在我的dist/assets
目录中有一个名为templates
文件夹,在该文件夹中将是app/templates/external
所有预编译模板。 This is my current Brocfile.js
attempt with broccoli stew 这是我目前的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);
There is npm package called broccoli-file-mover , easy to use , and can be found here 有一个名为broccoli-file-mover的 npm软件包,易于使用,可以在这里找到
The usage is very simple , as easy as : 用法非常简单,就像:
moveFile(inputTree, options) moveFile(inputTree,options)
can be used to move files ( multiple , or single ) , or whole folders 可用于移动文件(多个或单个)或整个文件夹
Example : 示例:
Moving a single file from app/main to app: 将单个文件从app / main移动到app:
var moveFile = require('broccoli-file-mover');
var tree = moveFile('app', {
srcFile: 'app/main.js',
destFile: '/app.js'
});
Moving app/main to app and test/main to test: 将app / main移动到app并测试/ main测试:
var moveFile = require('broccoli-file-mover');
var tree = moveFile('app', {
files: {
'app/main.js': 'app.js',
'test/main.js': 'test.js'
}
});
Also , prior to blessnm comment broccoli funnel is a possible solution , as you can copy your directory to wherever you want ( thought the question states moving , but thought copying might be an acceptable solution ) , here is the repo of the plugin. 此外 ,在blessnm评论之前,broccoli漏斗是一种可能的解决方案,因为您可以将目录复制到您想要的任何位置(认为问题表明移动,但认为复制可能是一个可接受的解决方案), 这里是插件的回购。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.