【发布时间】:2015-03-27 17:57:43
【问题描述】:
我想在 Brocfile.js 中包含一个配置设置,这样我就不会直接在文件中设置它。例如,在 config/custom.js 我会有类似的东西:
export default {
path: 'http://abc.blah.com/'
};
在我的 Brocfile 中,我想做类似的事情:
if (process.env.EMBER_ENV === 'development') {
app.options.inlineContent = {
assetPrefix: {
content: customConfig.path
}
};
}
如何在我的 Brocfile 中导入/包含 custom.js,并使用它的 path 属性?我尝试导入,但得到:
import config from 'config/custom.js';
^^^^^^
Unexpected reserved word
更新:
根据下面的答案,我的文件最终看起来是这样的:
// config/custom.js
module.exports = {
assetPrependPath: 'http://abc.blah.com/'
};
// Brocfile.js
var customConfig = require('./config/custom');
...
if (process.env.EMBER_ENV === 'development') {
app.options.inlineContent = {
assetPrefix: {
content: customConfig.assetPrependPath
}
};
}
【问题讨论】:
标签: ember.js ember-cli broccolijs