I'm facing a dilemma with my Angular app. I have several JS files included in the index.html file, and when the app loads, all these files are downloaded before the app is ready.
<html>
...
<script src="scripts/controllers/loginController.js"></script>
<script src="scripts/controllers/explainedController.js"></script>
<script src="scripts/controllers/homeController.js"></script>
<script src="scripts/controllers/menuController.js"></script>
<script src="scripts/controllers/listController.js"></script>
<script src="scripts/controllers/treeController.js"></script>
<script src="scripts/controllers/jqueryController.js"></script
..
</html>
For performance optimization, I decided to use grunt tasks for concatenation and minification with
grunt-contrib-concat, grunt-contrib-uglify
After the minification process, I now have only one file, so my index file has changed to:
<html>
...
<!--script src="scripts/controllers/loginController.js"></script>
<script src="scripts/controllers/explainedController.js"></script>
<script src="scripts/controllers/homeController.js"></script>
<script src="scripts/controllers/menuController.js"></script>
<script src="scripts/controllers/listController.js"></script>
<script src="scripts/controllers/treeController.js"></script>
<script src="scripts/controllers/jqueryController.js"></script-->
<script src="scripts/production.min.js"></script> <!--Minified file -->
...
</html>
This change has reduced the number of HTTP calls to just one.
Now I'm wondering if switching to require.js will further enhance the performance or reduce the number of HTTP calls. Personally, I don't think so.
In summary, my question is: In order to improve the performance of an Angular app, is it better to use grunt tasks for minification and concatenation, or should I consider using require.js?