30th October, 2013

Example of RequireJS config file to optimise and include RequireJS loader.

I haven't tried Almond yet, it might be better to use as a loader.

({
baseUrl: 'src/',

paths: {
'jquery': 'libs/jquery/jquery-1.10.2.min',
'eve': 'libs/raphael/eve/eve',
'raphael': 'libs/raphael/raphael',
'requireLib': 'libs/require/require',
'underscorelib': 'libs/underscore/underscore.min',
                'jqueryui-effects': 'libs/jqueryui/jquery-ui-1.10.3.custom.min'
        },

        shim: {
                'eve': {
                        exports: 'eve'
                },
                'raphael': {
                        deps: [
                                'eve'
                        ],
                        exports: 'Raphael'
                },
                'underscorelib': {
                        exports: '_'
                },
                'jqueryui-effects': {
                        deps: [
                                'jquery'
                        ]
                }
},

name: 'bootstrap',
include: [ 'bootstrap' ],
insertRequire: [ 'bootstrap' ],
out: './outputfile-map.min.js',

optimize: 'uglify2',

generateSourceMaps: true,

preserveLicenseComments: false
})

 

The opinions expressed here are my own and not those of my employer.