Tuz
Tuz

Reputation: 1980

is minify improve performance of angular js or just loading performance?

I have 40-60 scripts in my index. most of us angular I want in production to make them as a 1 script only

is it possible? all the logic will works? which library is the best for it?

is it good for performance or only for loading performance

Upvotes: 0

Views: 350

Answers (1)

Eric
Eric

Reputation: 111

You will want to use something like webpack or SystemJS. These will bundle you JS files all into one file and can minify/uglify this code as well.

Doing this will improve the page loading times as there are less requests to load, and minifying will shrink the filesize down. Uglifing is just to make the js harder to interpret for someone trying to look at your code.

The performance of your angular app will not be improved by doing this however.

Something you can do to increase angular performance on production is turning of debug info, like so:

myApp.config(['$compileProvider', function ($compileProvider)
{
    $compileProvider.debugInfoEnabled(false);
}]);

According to the angular.js docs, this is good practise in production and should result in a performance boost.

You may also want to look in one time binding, and using a "track by" in any ng-repeats as other ways of improving performance.


EDIT : The above tips on angular performance all assume you are using angular.js as opposed to the newer Angular 2+

Upvotes: 1

Related Questions