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

How should the micro-addon work at build time #30

Open
begedin opened this issue Jul 15, 2015 · 0 comments
Open

How should the micro-addon work at build time #30

begedin opened this issue Jul 15, 2015 · 0 comments

Comments

@begedin
Copy link
Contributor

begedin commented Jul 15, 2015

While writing the PR description for the ember-cli feature, I started to reconsider how micro-addons should work.

How it works now

Currently, the files are copied from a flat file structure in such a way that the following happens:

  • components are accessible via import MyComponent from 'app-name/components/my-component';
  • libraries are accessible via import MyLibrary from 'app-name/lib/my-library';
  • helpers are accessible via import MyHelper from 'app-name/helpers/my-helper';

There are 3 addon hooks we use to make this work:

  • treeForApp copies and renames component.js, helper.js, library.js
  • treeForAddon copies style.css (for components)
  • treeForTemplates copies template.hbs

I think this might not be 100% according to convention and where they're accessible from fells a bit illogical.

How I think it should work

  • treeForAddon should copy all of them into addon/[type]/addon-name.[extension]
  • treeForApp should create the standard import-export modules for components and helpers, so they are also directly accessible from the app. Libraries should be importable from the addon only, so they do not require import-export modules.
  • treeForApp might be able to create a template, but if that is impossible, then treeForTemplates should still be used for that

I think this would follow convention more closely.

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

No branches or pull requests

1 participant