I'm using the requirejs optimiser and I have a lot of JavaScript files for this webapp. I would like to create separate minified scripts which group scripts for certain sections of the site.
My question is: how do I create minified groups of scripts and how I prevent script libraries for example JQuery from being added into these module groups which already exist in the scripts.min.js core script?
({
baseUrl: '../static/js',
mainConfigFile: '../static/js/main.js',
name: 'main',
out: '../static/js/scripts.min.js',
paths: {
requireLib: 'vendor/require/require.min'
},
include: ['requireLib', '_core']
})
The current setup above adds all non nested requires plus all the scripts inside _core module and combines it to create one script that is essential for every page.
Now I need to create separate minified scripts for search, user management etc I would like each section (which contains many files) to have its own minified and concatenated script.
For example the user management pages would have these script includes:
<script type="text/javascript" src="/static/js/scripts.min.js"></script>
<script type="text/javascript" src="/static/js/user_management.min.js"></script>
I have been following this tutorial to get the optimiser running: http://www.youtube.com/watch?v=m6VNhqKDM4E