如何从Ember CLI中监视特定文件夹?
答案 0 :(得分:0)
这是我的ember-cli-build.js
文件,其中进行了必要的更改,以取消监视“公共”目录。
const EmberApp = require('ember-cli/lib/broccoli/ember-app'),
ENV = require('./config/environment')(process.env.EMBER_ENV),
Funnel = require('broccoli-funnel'),
dependencies = require('./config/dependencies'),
UnwatchedDir = require('broccoli-source').UnwatchedDir;
module.exports = function (defaults) {
const app = new EmberApp(defaults, ENV.options),
imports = dependencies.imports;
for (let i = 0; i < imports.length; i++) {
app.import(imports[i]);
}
const compilationAssets = [],
funnels = dependencies.funnels;
Object.keys(funnels).forEach(function (key) {
const options = funnels[key],
funnelObj = new Funnel(key, options);
compilationAssets.push(funnelObj);
});
// This does the magic
if (process.env.EMBER_ENV === 'development' || process.env.EMBER_ENV == 'test') {
app.trees.public = new UnwatchedDir('public');
}
return app.toTree(compilationAssets);
};