requireJs order plugin:它可以存在于不同于require.js basePath的路径中吗? [英] requireJs order plugin: can it exist in a different path than the require.js basePath?

查看:73
本文介绍了requireJs order plugin:它可以存在于不同于require.js basePath的路径中吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用订单插件时,require.js在给定的basePath / order.js中查找它

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

示例:

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();
            });
        }
    );

它在 http://url.com/中查找订单插件public / js / order.js 我可以以某种方式将它存储在我的javascript文件夹的根目录中吗?

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?

推荐答案

您可以将插件放在任何您喜欢的位置,并在配置RequireJS时指向其路径:

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"
    },
    ...

这篇关于requireJs order plugin:它可以存在于不同于require.js basePath的路径中吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆