In this short post I will give a quick introduction to some of the ways you can improve the performance of your application using really quick and simple techniques.
Below I will list some of the really easy things you can do to speed up your applications, with a little help from Grunt.
1. Folder Structure
One of the first Grunt tasks that I used and probably the most useful. With Uglify you can point it to the folder that contains all your js files, Grunt will then go off minify them and write them to a chosen destination folder with your chosen extension.
For the minified versions I recommend having a common location for all compressed, production ready scripts/assets, It is helpful to separate the two locations as ideally you don’t want to be debugging minified js in dev environments. So this means you can alter the development grade scripts and have Grunt minify them for use in the application.
Question : Do I need to manually run the Grunt task to see my changes locally ?
Answer : No, There are multiple ways you can get around this, my favourite is by setting up a watcher. Watchers wait for changes on certain files (in this case the dev js) when a file is changed it can trigger a task (in this case Uglify), Using this method means every time you change the development JS its automatically compressed and written to the dist location.
So changing ROOT/js/app.js would create a compressed equivalent in ROOT/dist/js/app.min.js