How to add javascript provider in ember-cli 2.2

This may be a stupid question related to ignorance. I am rewriting a project that previously used Ember 1.7 in Ember 2.3 using Ember-cli v2.2

Now, in the old project, several libraries were manually included in the index.html file, placed in the script directory, and then compiled. For example, suppose the JS asset that I want to enable is offline.js.

I understand that Ember-cli uses Bower and can be used to install tower components like Bootstrap or moment.js, etc. What about custom js? I put the file in offline.js, included it in index.html, but it does nothing.

I do not think that I understand how to add / import supplier’s assets at all; how to add, say, offline.js to a project and use it throughout the application?

+5
source share
1 answer

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

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

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

+13
source

Source: https://habr.com/ru/post/1241377/


All Articles