[英]Exclude files from broccoli Ember 2.0
Hi im kind of new to ember, im looking for a way to tell broccoli not to include my img/ directory, i want to include some default images there which ill be programatically adding to the app 嗨,我是ember的新手,我正在寻找一种方法告诉西兰花不包含我的img /目录,我想在其中包含一些默认图像,这些图像无法通过编程方式添加到应用中
<img src='{{model.picture}}'/>
And i can see them ok in development but not in production since the name has a hash attaches due to brocolli task, how do i configure my BrocFile to exclude files in the directory i have checked the documentation here 而且我可以看到它们在开发中正常,但在生产中却没有,因为该名称由于brocolli任务而具有哈希附加,我如何配置BrocFile以排除目录中的文件,我已在此处检查了文档
https://github.com/rickharrison/broccoli-asset-rev https://github.com/rickharrison/broccoli-asset-rev
but i cant figure out where in my brocfile im expected to add that. 但我不知道我期望在我的brocfile中的什么地方添加它。
part of my brocfile 我的文件的一部分
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var app = new EmberApp({
modals: {
layout: true,
style: true,
animation: 'scale'
}
});
app.import({
production: 'bower_components/raygun4js/dist/raygun.js'
});
app.import('bower_components/lodash/lodash.js');
Since you are using Ember (and Ember-CLI), just make sure to scroll down far enough in the broccoli-asset-rev documentation that you linked and you will reach the part most relevant to your circumstance. 由于您使用的是Ember(和Ember-CLI),因此请确保在您链接的西兰花资产-rev文档中向下滚动足够多的内容,然后您会看到与您的情况最相关的部分。 In particular, the provided 'Ember CLI addon usage' example should already be a close match for your case. 特别是,提供的“ Ember CLI插件用法”示例应该已经非常适合您的情况。
Adapting that to your stated problem and provided code, you would perhaps get something along the lines of 使之适应您陈述的问题并提供代码,您可能会得到一些与
var app = new EmberApp({
fingerprint: {
exclude: ['img/']
},
modals: {
layout: true,
style: true,
animation: 'scale'
}
});
The relevant Ember-CLI documentation section also explains fingerprinting in slightly more detail. 相关的Ember-CLI文档部分也更详细地说明了指纹。
Other than using the exclude
option, you could 除了使用exclude
选项,您还可以
enabled: false
if you don't actually need fingerprinting 设置为enabled: false
如果您实际上不需要指纹,则为enabled: false
extensions: ['js', 'css', 'map']
通常不通过扩展名来包含图像扩展extensions: ['js', 'css', 'map']
This answer applies for Ember 2.x through at least 3.x. 此答案适用于Ember 2.x到至少3.x。
Another approach is to use an addon that helps you easily exclude files. 另一种方法是使用可帮助您轻松排除文件的插件。 Installing ember-cli-funnel and then specifying the file accomplishes this pretty nicely: 安装ember-cli-funnel然后指定文件可以很好地完成此操作:
// ember-cli-build.js
let app = new EmberApp(defaults, {
funnel: {
exclude: [
`${defaults.project.pkg.name}/routes/style-guide/**/*`,
'addon-tree-output/some-addon/styles/**/*.scss'
]
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.