2

I'm using mirage to mock some data and I'd like to mock an <img> with the appropriate file.

The problem is that I will have to place the image in /public/assets and the images placed there will be deployed later on as well.

Is there a way to avoid this? I couldn't find a recommendation in the ember cli website (https://ember-cli.com/user-guide/#asset-compilation)

I found one addon that could do this (ember-test-assets), but I'd like to avoid installing extra addons as much as possible.

Thanks!

renno
  • 2,659
  • 2
  • 27
  • 58

1 Answers1

1

You can exclude files in ember-cli-build.js with some help of Broccoli

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();
};

References:

enspandi
  • 663
  • 4
  • 6