How can I include jQueryUI in my modular backbone.js app using RequireJS?

后端 未结 4 1817
迷失自我
迷失自我 2020-12-09 19:05

I want to include jQueryUI in my backbone.js app using RequireJS. The main.js file included in my index.html is as follows:

require.config({
    paths: {
            


        
4条回答
  •  渐次进展
    2020-12-09 19:42

    You can include all files that only patch some other object (like jQuery UI) in your main file as follows (you need to make sure jQuery is loaded before jQuery UI):

    require(['jquery', 'app', 'jqueryui'], function ($, App) { App.start(); });
    

    Another approach is to include jQuery UI in every module as you already mentioned.

    I personally prefer first approach even though it's hiding dependencies.

提交回复
热议问题