Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do i add vendor javascript to ember-cli 2.2

This might be a silly question stemming from unfamiliarity. I'm rewriting a project that was previously using Ember 1.7 in Ember 2.3, using Ember-cli v2.2

Now, in the old project, there were a couple of libraries being included manually on the index.html file, put in the scripts directory and then compiled. For example, let's say the JS asset I want to include is offline.js.

I understand that Ember-cli uses Bower and can be used to install bower components, like Bootstrap or moment.js and such. What about custom JS? I've put the file in offline.js, included it in index.html but that doesn't do anything.

I don't think I understand how to add/import vendor assets at all; how do add, say offline.js to the project and have it available throughout the application?

like image 403
Darshan Avatar asked Jan 25 '16 02:01

Darshan


1 Answers

You should add the offline.js file to the vendor folder at the root of the project, and then in your ember-cli-build.js file add the following line:

app.import('vendor/offline.js');

This adds the offline.js file to the vendor.js which is built by default. You can see more documentation at the Ember CLI website.

like image 120
locks Avatar answered Nov 17 '22 04:11

locks