开发者

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

开发者 https://www.devze.com 2023-04-03 15:43 出处:网络
when using the order plugin require.js looks for it inthe given basePath/order.js example: require( { baseUrl: \'/public/js/\'

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.ru开发者_如何学JAVAn();
            });
        }
    );

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?


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

精彩评论

暂无评论...
验证码 换一张
取 消