Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Ember: show how to use app.toTree() to copy assets instead of a package script #4

Closed
tomwayson opened this issue May 27, 2020 · 1 comment

Comments

@tomwayson
Copy link
Member

A slightly more Ember-ish way to copy the assets would be to include them in app.toTree().

I'm thinking of trying the following and if it works Adding CSS and Adding Icons README sections could be combined into a single section w/ the following snippet:

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

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

  // tell the app to import the global stylesheet
  app.import('node_modules/@esri/calcite-components/dist/calcite/calcite.css');

  // copy the assets to the app's public folder
  const calciteComponentsAssetsTree = new Funnel(path.dirname(require.resolve('@esri/calcite-components/dist/calcite/calcite.css')), {
    files: ['assets']
  });

  return app.toTree(calciteComponentsAssetsTree);
};

I've copied that from our app where I've verified that it works w/ development builds. However, I have yet to verify it in a production build that does fingerprinting and prepending w/ CDN URLs. If there were any problems w/ fingerprinting and prepending, they would apply to the copy script too, so I figure we might as well try it here.

@paulcpederson
Copy link
Member

Fixed as part of #6

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants