I'm using grunt and was wondering what the best practice was regarding concat and uglify?
Which should I use first?
Should I concat the file and then uglify or uglify the file then concat?
It doesn't matter. Running uglify after concat will remove any introduced line breaks, but the size of the resulting file should be pretty much the same.
If all you need is to combine and compress JS files, uglify
can do that by itself.
You should consider the performance implications of running concat
before uglify
when the sourcemap
option is enabled.
See my detailed test case in this similar question:
https://stackoverflow.com/a/27452514/2048613