gpt4 book ai didi

testing - 在 emberjs 中放置开发/测试 Assets 的地方

转载 作者:行者123 更新时间:2023-11-28 20:36:43 25 4
gpt4 key购买 nike

我正在使用 Mirage 来模拟一些数据,我想模拟一个 <img>使用适当的文件。

问题是我必须将图像放在 /public/assets 中放置在那里的图像也将在稍后部署。

有没有办法避免这种情况?我在 ember cli 网站上找不到推荐 ( https://ember-cli.com/user-guide/#asset-compilation )

我找到了一个可以做到这一点的插件 (ember-test-assets),但我想尽可能避免安装额外的插件。

谢谢!

最佳答案

您可以在 Broccoli 的帮助下排除 ember-cli-build.js 中的文件

const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const Funnel = require('broccoli-funnel');

module.exports = function(defaults) {
let app = new EmberApp(defaults, {
// Add options here
});

// Filter your test files in 'production'
if (EmberApp.env() === 'production') {
return new Funnel(app.toTree(), {
exclude: ['**/test-*'] // e.g. any file prefixxed with 'test-'
});
}
return app.toTree();
};

引用资料:

关于testing - 在 emberjs 中放置开发/测试 Assets 的地方,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51958155/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com