What is the proper way to load custom assets?


#1

Hello! I am new to Ember CLI and am having issues with loading custom generated assets. I would like to achieve the following with Rails and Ember:

  • Changes made to Rails yml file should generate a script.
  • The script should only be served in certain environments.
  • Should work when ONLY serving the Ember app.

So far, I’ve added the following to the ember-cli-build.js:

  var extraAssets;
  if (app.env === 'development') {
    extraAssets = new Concat('../', {
      outputFile('vendor/xyz.js')
    });
    app.import('vendor/xyz.js');
  } 

  return app.toTree(extraAssets);

I’m not sure whether this is the correct area to do this. There is also a bug where I need to save the yml files twice in order for the changes to render properly.