I am willing to optimize my javascript application using require.js optimizer but I am now wondering if it is also possible to include the require.config paths as well as the javascript modules in one single file. In fact, after running r.js, I would like to end up with one final javascript file that is main-built_v_0_1.js including all the paths + other js files.
Here you have my main.js file:
require.config({
paths : {
// Backbone libs
jquery : '../lib/jquery/jquery-1.7.1.min',
underscore : '../lib/underscore/underscore-min',
backbone : '../lib/backbone/backbone',
text : '../lib/require/text',
// JQGrid
jgqridi18n : '../lib/jqgrid/js/i18n/grid.locale-en',
jqgrid : '../lib/jqgrid/jquery.jqGrid.min',
// Templates root directory
templates : '../templates'
}
});
Then I have my backbone.js files that is app.js, router1.js, model1.js, view1.js,etc....
Anyone ever done this before? If it is possible to do so, how could require.js then resolve these aliases spread throughout the application?
The build also does not automatically read the config from the main.js file. There is an option to do so, mainConfigFile, see mainConfigFile reference