最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - requireJs order plugin: can it exist in a different path than the require.js basePath? - Stack Overflow

programmeradmin2浏览0评论

when using the order plugin require.js looks for it in the given basePath/order.js

example:

require(
        {
            baseUrl: '/public/js/'
        },
        [
            'require',
            'order!.js/1.1.7/underscore-min.js',
            'order!.js/0.5.3/backbone-min.js',
            'order!.js'
        ], 
        function (require) {
            require(['application'], function (app) {
                app.run();
            });
        }
    );

it looks for the order plugin in .js could I somehow store it not in the root of my javascript folder?

when using the order plugin require.js looks for it in the given basePath/order.js

example:

require(
        {
            baseUrl: '/public/js/'
        },
        [
            'require',
            'order!http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.1.7/underscore-min.js',
            'order!http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.5.3/backbone-min.js',
            'order!http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js'
        ], 
        function (require) {
            require(['application'], function (app) {
                app.run();
            });
        }
    );

it looks for the order plugin in http://url.com/public/js/order.js could I somehow store it not in the root of my javascript folder?

Share Improve this question asked Sep 9, 2011 at 14:41 SanderSander 13.4k15 gold badges73 silver badges98 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 22

You can place your plugins anywhere you like and point to their paths when configuring RequireJS:

require({
    baseUrl: "/public/js/",
    paths: {
        order: "requirejs/plugins/order"
    },
    ...
发布评论

评论列表(0)

  1. 暂无评论