I have an angularjs app. I want to concatenate all the angularjs files to single file. I am using grunt and searched about concatenating grunt plugins. I found there are grunt-contrib-concat and grunt-concat-in-order plugins.
But, I am not able to find answers with example on how to concatenate files with dependencies. Please let me know how to specify the dependencies if i use grunt-concat-in-order plugin.
Note: In grunt-concat-in-order documentation it says to specify framework.require("moduleA"). But not sure what framework is. Is there any efficent way to specify the dependency in a single file ?
Thanks in advance, Rajaguru
According to grunt-contrib-concat, it will concat files in order https://github.com/gruntjs/grunt-contrib-concat#usage-examples
However I suggest you to use grunt-usemin to do the job, which works well with grunt-wiredep (you need to use bower and it solves your dependency issues)
To make this short, I suggest you to checkout generator-angular and generator-angular-fullstack to see what plugins they are using.
To @jsbueno, you are not answering this question. But what you want is ng-annotate.
I don't know about the options you have in grunt - but Angular.js code depends on specific name of parameters for the functions used to declare its controlers, factories and so on.
I.e. when you declare a controler like
myModule.controler(function ($scope) {...}) - the $scope there must be the actual variable name - a javascript minifier tool unaware of this will change the variable name to a shorter one, and it will go by unrecognized by angular.
So, unless you can find some specific grunt option to make it avoid changing functions and parameter names (and lilely variables as well), you can't apply it to angular.js projects. Gulpjs has options to just concatenate he javascript files together, without name mangling, thus avoiding this problem.