javascript - Include library with require.js -
javascript - Include library with require.js -
i've added external library spin.js
project,built require.js , backbone
. i've added path in main.js
:
require.config({ paths: { jquery: 'libs/jquery/jquery-min', underscore: 'libs/underscore/underscore-min', backbone: 'libs/backbone/backbone', templates: '../templates', handlebars: 'libs/handlebars/handlebars', codebird:'libs/codebird-js-develop/codebird', oauth:'libs/oauth', **spin:'libs/spin'** } }); require([ 'app', ], function(app){ app.initialize(); });
and called library in view,but console tells me spinner
(function in library) not defined:
define(["spin"], function (spin) {}
after defining paths seek add together shim config like:-
shim: { spin: { deps: ['jquery'], exports: 'spin' } }
i don't know whether spin.js requires jquery or not, it's example, spin.js requires other libray seek define in dependency otherwise define exports.
also check whether you're using amd version of spin.js or not.
javascript backbone.js requirejs
Comments
Post a Comment