Search code examples
angularjsuglifyjs

How do I combine angular and some additional modules into one minified file with a source map?


What I’m trying to do is take angular and some of the additional modules like route, cookies... and combine them into one minified js file with a source map. I'm using grunt as my build tool. Right now I just concat the pre minified versions of angular and modules all together into one file. The problem is the file has multiple source maps and does not work. I have been thinking about using grunt to take the non minified version and concat them into one and then uglify them and make one source map. I just don't know if that's a good idea. I also have read I will have to use ng-annotate if I go this direction.


Solution

  • What you suggest is what I do, except with gulp. I concat all my javascript files into one file, minify the code, and generate a source map for just the one file.

    I also do use ng-annotate. It's pretty convenient and allows you to stop thinking about dependency injection - it just takes care of it for you.