Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Addons to Add Icons to the Build #91

Merged
merged 2 commits into from
Feb 20, 2019

Conversation

jrjohnson
Copy link
Collaborator

Instead of relying on the app to discover and include needed icons, this
allows each addon to register their needs in config/icons.js and they will be
picked up by the app and added to the final build.

Hoping for feedback on the file location and the format before I write any docs. Addons would supply icons as a module:

module.exports = function() {
  return {
    'free-solid-svg-icons': 'all',
    'free-brands-svg-icons': [
      'black-tie'
    ],
  };
};

I've elected to wrap it in a function in case we want to provide arguments in the future. Other addons like ember-intl consolidate configuration like this and I think it is a good pattern here.

Another option I considered would be to read any icon configuration in the addon config/environment.js and bundle it into the app, but ember-cli currently does a shallow merge of those options into the app which wouldn't include combining the icons options together. I feel like having our own configuration file is actually a bit less surprising than having a single option in the addons environment.js file which is magically merged into the app configuration.

Steps after this is complete would include:

  1. Deprecating the icons option in the environment.js of apps and addons
  2. Auto detecting static icon names in templates so addons don't need to list everything manually or creating some kind of test integration like ember-cli-deprecation-workflow does that would find icon names and make it easy to create the icons.js file (or maybe both!)

@jrjohnson jrjohnson marked this pull request as ready for review February 20, 2019 15:34
Instead of relying on the app to discover and include needed icons, this
allows each addon to register their needs in `config/icons.js` and they will be
picked up by the app and added to the final build.
README.md Show resolved Hide resolved
@robmadole
Copy link
Member

This is fantastic. Nice work. The file format and the way it operates looks great.

@jrjohnson jrjohnson merged commit 0b2839c into FortAwesome:master Feb 20, 2019
@jrjohnson jrjohnson deleted the addon-icons branch February 20, 2019 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants