6

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?

1 Answer 1

14

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much. I feel like an idiot; that pretty much took care of the entire issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.