XVirtusX
XVirtusX

Reputation: 709

Loading Jquery plugin through RequireJS

I am using requirejs in a project and everything was running smoothly. Until I had to add a jquery plugin named 'elastislide' to my project. I'm using a shim config to specify the plugin's dependency to jquery and jquery++. It's like the following:

requirejs.config({
paths: {
    jquery: 'libs/jquery',
    jquerymobile: 'libs/jquery-mobile/jquery.mobile',
    underscore: 'libs/underscore',
    jquerypp: 'libs/jquerypp',
    elastislide: '../js/elastislide',
    app: '../js/app',
    model: '../js/app/model',
    view: '../js/app/view',
    controller: '../js/app/controller',

    shim: {
        'elastislide': {
            deps: ['jquery', 'jquerypp']
        }
    }
  }
});

And in my app entry point I have this:

define([
'jquery',
'jquerymobile',
'jquerypp/event/swipe',
'elastislide',
'model',
'view',
'controller'


], function ($, mobile, jqpp, elastislide, model, view, controller) {
//

And I keep getting the error message: "Uncaught ReferenceError: jQuery is not defined". I already revised the requirejs documentation and couldn't see the error. Can anyone please point a solution?

here is the plugin's site: http://tympanus.net/codrops/2011/09/12/elastislide-responsive-carousel/

thanks in advance!

Upvotes: 2

Views: 86

Answers (1)

Mohd. Shaukat Ali
Mohd. Shaukat Ali

Reputation: 752

You can try by replacing this..

deps: ['jquery, jquerypp']

with

deps: ['jquery',  'jquerypp']

As per Require.js doc, deps accept array...

Upvotes: 2

Related Questions