minification of angularjs itself

92 views
Skip to first unread message

Johan Dindaine

unread,
Oct 5, 2014, 9:33:58 PM10/5/14
to ang...@googlegroups.com
I am trying to minify my project in two files:
. one minified files which contains all our dependencies, eg: angular.js, angular-route.js, angular-touch.js, underscore.js etc,
. one minified file which represent my application, eg: userModule and business modules.

I tried to achieve this in two ways:
. by concatenating the minified version of the libraries that I need for my project and secondly,
. by concatenating all the un-minified version of the same libraries and minifying it with uglifyjs.

In either way the resulting files was throwing "Unexpected token" exceptions in the browser due to some syntactic issues in angular.js file.

So I wonder how anyone can ever minify that file at all. Should I use another tool instead?

Sander Elias

unread,
Oct 6, 2014, 12:26:43 AM10/6/14
to ang...@googlegroups.com
Hi Johan,

Concatenating the minified version should give you no problem. However, you should take care on
the ordering of your resources. If you for example put angular-route before angular itself, you might
get the error you are experiencing. 

the same issue goes on of you do the build and minify the libraries yourself. This is however not
recommend, there are some issues that you should take in account if you want to minify angular yourself.

Regards
Sander Elias

Johan Dindaine

unread,
Oct 6, 2014, 7:00:17 AM10/6/14
to ang...@googlegroups.com
I got the resource from bower, could that be the problem?

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Sander Elias

unread,
Oct 6, 2014, 7:38:20 AM10/6/14
to ang...@googlegroups.com
Hi Johan,

No, that's not the problem. The problem is the order in wich you concatenate your files. AngularJS should go first.

Regards
Sander

Johan Dindaine

unread,
Oct 6, 2014, 12:42:40 PM10/6/14
to ang...@googlegroups.com, Sander Elias
I thought that Jquery needed to come first so that angular avoid using its jqlite then angularjs then angular-route and so on.

--

Tony pee

unread,
Oct 6, 2014, 1:28:13 PM10/6/14
to ang...@googlegroups.com, Sander Elias
yes, this is true. Jquery, angular, angular modules, etc. 

I use uglify over my dependencies like this and have no issues, in even your most basic test things fail?
--
Tony Polinelli

Sander Elias

unread,
Oct 7, 2014, 3:26:08 AM10/7/14
to ang...@googlegroups.com, sande...@gmail.com
Hi Johan,

That's right, but you didn't mention jQuery earlier, so I didn't take that in account ;)

Regards
Sander
Reply all
Reply to author
Forward
0 new messages