Skip to content

Latest commit

 

History

History
37 lines (30 loc) · 587 Bytes

requirejs.md

File metadata and controls

37 lines (30 loc) · 587 Bytes

RequireJS

Shims

Configure dependencies, exports and custom init code

Necessary for scripts that do not support AMD/RequireJS

Shim config example:

requirejs.config({
  shim: {
    'scriptname': {
      deps: ['scriptdep1', 'scriptdep2'],
      exports: 'ValueToExportViaAMD',
      init: function () {
        //...
      }
    }
  }
});

Or the shim config value can just be an array of dependencies:

requirejs.config({
  shim: {
    'jquery.colorize': ['jquery'],
    'jquery.scroll': ['jquery'],
    'backbone.layoutmanager': ['backbone']
  }
});