O'Reilly logo

Instant Dependency Management with RequireJS How-to by Greg Franko

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using jQuery and jQueryUI Widget Factory plugins with RequireJS (Advanced)

This section will demonstrate how to use jQuery and jQueryUI Widget Factory plugins with Require.js. In case you are not familiar, the jQueryUI Widget Factory provides a consistent API for building jQuery plugins and has become a popular tool for jQuery plugin authors.

Since more and more jQuery plugins use the jQueryUI Widget Factory, it is necessary to understand how to use these jQuery plugins with AMD loaders, such as Require.js.

How to do it...

We must declare the jquery alias name within our Require.js configuration file.

require.config({
    // 3rd party script alias names
    paths: {
    // Core Libraries
     // --------------
      // jQuery
      "jquery": "libs/jquery", // Plugins // ------- ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required