I am successfully importing a jQuery plugin via Bower to be used in a component in an Ember-cli addon. However, this only works is because I defined a Bower dependency on this plugin in both the addon and the consuming application.
This seems like I'm doing it wrong. Why should the consuming application have to declare a dependency on a resource that should be provided with the addon?
The crux of the matter seems to be the app
context when building. I can omit the Bower dependency in the consuming application if I use the following import
statement in the addon's index.js
file:
app.import('node_modules/my-ember-cli-addon/bower_components/jquery.stickyHooters/dist/jquery.stickyHooters.min.js');
... but this breaks when I build the addon as a stand-alone application. In that case, this path is required:
app.import('bower_components/jquery.stickyHooters/dist/jquery.stickyHooters.min.js');
How this is intended to work?
app
context in the index.js
of the addonCheckout ember-cli homepage on default blueprints. It describes how you can import a bower component package upon installing your addon.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With