J.Dev
J.Dev

Reputation: 11

Ember-Cli import js without bower

I should import this plug-in that is not present in bower: ImageTiltEffect, in my ember-cli app. I already created the sub-directory in the vendor directory, imported this in my Brocfile and added "TiltFx": true in my .jshintrc file. About the last point I am not very sure if it is done in the right way, btw my question is: after these steps, how can I use this plug-in? How can I call its init function from my ember code? Thank you in advance for the answers!

Upvotes: 1

Views: 114

Answers (1)

Mario Pabon
Mario Pabon

Reputation: 605

Import the library in ember-cli-build.js:

app.import('vendor/tiltfx.js');
return app.toTree();

In your .jshintrc file, add TiltFx as a predefined global:

"predef": [
  "document",
  "window",
  "-Promise",
  "TiltFx"
],

You should now be able to use TiltFx.

component.js

onDidInsertElement: function() {
  new TiltFx(element, options)
}.on('didInsertElement'),

Upvotes: 2

Related Questions