SHT
SHT

Reputation: 720

BackboneJS + RequireJS How to add external JS-Plugins

I want to implement this external JS-plugin, https://github.com/GBKS/Wookmark-jQuery, into my Backbone App. My issue is that I use RequireJS and I really dont know how to get it running. I already asked this before BackboneJS + Require JS + Wookmark.js plugin not working but adding it to my App.js doesnt work at all. So does anyone know what might be the issue here?

The wookmark + imagesloaded plugins both appear in my console, so they get loaded. I tried to run it from a View with no success.

Please help...

Upvotes: 0

Views: 115

Answers (1)

mms27
mms27

Reputation: 826

Since wookmark depends on jquery, I would recommend adding it to requirejs shim:

require.config({
  paths: {
    jquery: 'path/to/jquery'
    wookmark: 'path/to/wookmark'
  },

  shim: {
    wookmark: { deps: [ 'jquery' ] }
  }
});

Hope it will solve your problem.

Upvotes: 1

Related Questions