Search code examples
importbowerember-clipnotify

Ember-Cli import plugin without bower


I need to import in my ember-cli project some GitHub plugins like PNotify and Ember-suggest. Bower does not find them or, in the specific case of Pnotify, when I try to execute the command 'ember server' it says that PNotify is not defined.

Is there a way to import plugins without using bower or npm manager?

Thanks.


Solution

  • With current ember-cli >= 0.0.42 there is a difference between the bower_components directory and the vendor directory. bower_components is ignored by default in the included .gitignore and should be where bower installs and updates standard components. vendor is for any strange one-off libraries that are not in the bower lookup, and will be checked in unless you add /vendor to your .gitignore

    If you want to import libraries that do NOT use Bower, for example myscroller.js, you should:

    1. Create a sub-directory in the vendor directory and manually copy your file. /vendor/myscroller/myscroller.js

    2. Add this to your Brocfile app.import('vendor/myscroller/myscroller.js');

    3. Add any global mehtods used by the library to the .jshintrc file. Do this by adding the name of the constant as true to the 'predef' section. "MyScroller": true,

    Now you can use your library anywhere as normal.