I am trying to link my javascripts using requirejs and build on top of it. There are some existing js files that were designed to manipulate the user interface and use the library.
These js files should be included immediately after jquery is turned on, as well as for social network widgets on the site. someone, I wrote the code below to try to link them so that they execute when the site loads, for some reason I see them loading on the firebug network. But the code inside does not work, because its execution more than once ..
Below is my configuration and approval is required, anyone can advise why this behavior occurs?
'use strict';
require.config({
paths: {
jquery: '../vendors/jquery/jquery-1.10.2.min',
underscore: '../vendors/underscore/underscore-min-1.5.1',
backbone_query: '../vendors/backbone-query-parameters/backbone.queryparams',
backbone: '../vendors/backbone/backbone-min-1.0.0',
theme: '../vendors/theme/v1.9/scripts/'
},
shim: {
'jquery': {
exports: '$'
},
'underscore': {
exports: '_'
},
'backbone': {
deps: ['underscore', 'jquery'],
exports: 'Backbone'
},
'theme/base': {
deps: ['jquery']
},
'theme/message': {
deps: ['jquery', 'theme/base']
},
'theme/input_counter': {
deps: ['jquery', 'theme/base', 'theme/message']
},
'theme/placeholder': {
deps: ['jquery', 'theme/base', 'theme/message', 'theme/input_counter']
},
'theme/scrollbar': {
deps: ['jquery', 'theme/base', 'theme/message', 'theme/input_counter', 'theme/placeholder']
},
'theme/fields': {
deps: ['jquery', 'theme/base', 'theme/message', 'theme/input_counter', 'theme/placeholder', 'theme/scrollbar']
},
'theme/validate': {
deps: ['jquery', 'theme/base', 'theme/message', 'theme/input_counter', 'theme/placeholder', 'theme/scrollbar', 'theme/fields']
},
'theme/main': {
deps: ['jquery', 'theme/base', 'theme/message', 'theme/input_counter', 'theme/placeholder', 'theme/scrollbar', 'theme/fields', 'theme/validate']
}
}
});
require(['jquery', 'theme/base', 'theme/message', 'theme/input_counter',
'theme/placeholder', 'theme/scrollbar', 'theme/fields', 'theme/validate', 'theme/main']);