Refactor require.js config

This commit is contained in:
Nicolas Le Goff
2014-02-28 11:06:28 +01:00
parent 1e2cc2692e
commit 0299250097
4 changed files with 55 additions and 61 deletions

View File

@@ -56,7 +56,7 @@
resize(); resize();
}); });
</script> </script>
<script type="text/javascript" src="{{ path('minifier', { 'f' : '/assets/requirejs/require.js, /scripts/apps/admin/main/main.js' }) }}"></script> <script type="text/javascript" src="{{ path('minifier', { 'f' : '/assets/requirejs/require.js, /scripts/apps/admin/require.config.js /scripts/apps/admin/main/main.js' }) }}"></script>
{% endblock %} {% endblock %}
{% block content %} {% block content %}

View File

@@ -7,25 +7,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
// configure AMD loading
require.config({
baseUrl: "/scripts",
paths: {
jquery: "../assets/jquery/jquery",
jqueryui: "../assets/jquery.ui/jquery-ui",
underscore: "../assets/underscore-amd/underscore",
backbone: "../assets/backbone-amd/backbone",
i18n: "../assets/i18next/i18next.amd-1.6.3",
bootstrap: "../assets/bootstrap/js/bootstrap.min"
},
shim: {
bootstrap: ["jquery"],
jqueryui: {
deps: [ "jquery" ]
}
}
});
// launch application // launch application
require(["apps/admin/fields/app"], function (App) { require(["apps/admin/fields/app"], function (App) {
App.initialize(); App.initialize();

View File

@@ -7,47 +7,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
// configure AMD loading
require.config({
baseUrl: "/scripts",
paths: {
jquery: "../assets/jquery/jquery",
"jquery.ui": "../assets/jquery.ui/jquery-ui",
underscore: "../assets/underscore-amd/underscore",
backbone: "../assets/backbone-amd/backbone",
"jquery.ui.widget": "../assets/jquery-file-upload/jquery.ui.widget",
"jquery.cookie": "../assets/jquery.cookie/jquery.cookie",
"jquery.treeview": "../assets/jquery.treeview/jquery.treeview",
"jquery.tooltip": "../assets/jquery.tooltip/jquery.tooltip",
"blueimp.loadimage" : "../assets/blueimp-load-image/load-image",
"jfu.iframe-transport": "../assets/jquery-file-upload/jquery.iframe-transport",
"jfu.fileupload": "../assets/jquery-file-upload/jquery.fileupload"
},
shim: {
"jquery.treeview": {
deps: ['jquery', 'jquery.cookie'],
exports: '$.fn.treeview'
},
"jquery.cookie": {
deps: ["jquery"],
exports: '$.fn.cookie'
},
"jquery.tooltip": {
deps: ["jquery"],
exports: '$.fn.tooltip'
},
"jquery.ui": {
deps: ["jquery"]
},
"jquery.ui.widget": {
deps: ["jquery"]
},
"jfu.fileupload": {
deps: ["jquery.ui.widget"]
}
}
});
// launch application // launch application
require(["jquery", "apps/admin/main/app"], function ($, App) { require(["jquery", "apps/admin/main/app"], function ($, App) {
App.initialize({ App.initialize({

View File

@@ -0,0 +1,54 @@
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
// configure AMD loading
require.config({
baseUrl: "/scripts",
paths: {
jquery: "../assets/jquery/jquery",
"jquery.ui": "../assets/jquery.ui/jquery-ui",
underscore: "../assets/underscore-amd/underscore",
backbone: "../assets/backbone-amd/backbone",
"jquery.ui.widget": "../assets/jquery-file-upload/jquery.ui.widget",
"jquery.cookie": "../assets/jquery.cookie/jquery.cookie",
"jquery.treeview": "../assets/jquery.treeview/jquery.treeview",
"jquery.tooltip": "../assets/jquery.tooltip/jquery.tooltip",
"blueimp.loadimage" : "../assets/blueimp-load-image/load-image",
"jfu.iframe-transport": "../assets/jquery-file-upload/jquery.iframe-transport",
"jfu.fileupload": "../assets/jquery-file-upload/jquery.fileupload",
i18n: "../assets/i18next/i18next.amd-1.6.3",
bootstrap: "../assets/bootstrap/js/bootstrap.min"
},
shim: {
"jquery.treeview": {
deps: ['jquery', 'jquery.cookie'],
exports: '$.fn.treeview'
},
bootstrap:{
deps: ['jquery']
},
"jquery.cookie": {
deps: ["jquery"],
exports: '$.fn.cookie'
},
"jquery.tooltip": {
deps: ["jquery"],
exports: '$.fn.tooltip'
},
"jquery.ui": {
deps: ["jquery"]
},
"jquery.ui.widget": {
deps: ["jquery"]
},
"jfu.fileupload": {
deps: ["jquery.ui.widget"]
}
}
});