From 39a4d4989d4d3c999d25196de9670be1228e7680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Macias?= Date: Tue, 12 May 2015 17:06:04 +0200 Subject: [PATCH] Boost Angular performance by disable debug and add ng-strict-di in demo app --- Gruntfile.js | 4 ++-- examples/blog/config.js | 12 ++++++------ examples/blog/index.html | 2 +- src/javascripts/ng-admin.js | 5 +++-- src/javascripts/test/protractor.conf.js | 4 ++++ 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 25569ecb..9e00deae 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -183,7 +183,7 @@ module.exports = function (grunt) { }, javascripts: { files: ['src/javascripts/ng-admin.js', 'src/javascripts/ng-admin/**/**/*.js', 'src/javascripts/ng-admin/**/**/*.html'], - tasks: ['ngconfig', 'requirejs:dev', 'copy:js_dev', 'copy:es6_dev', 'copy:es6_devmap'], + tasks: ['ngconfig', 'requirejs:dev', 'ngAnnotate', 'copy:js_dev', 'copy:es6_dev', 'copy:es6_devmap'], options: { atBegin: true, livereload: true @@ -250,7 +250,7 @@ module.exports = function (grunt) { grunt.registerTask('test:local', ['mochaTest', 'karma', 'build:dev', 'copy_build:dev', 'test:local:e2e']); grunt.registerTask('test:local:e2e', ['json_server', 'connect', 'protractor']); - grunt.registerTask('build:dev', ['ngconfig', 'requirejs:dev', 'compass:dev', 'concat:css']); + grunt.registerTask('build:dev', ['ngconfig', 'requirejs:dev', 'ngAnnotate', 'compass:dev', 'concat:css']); grunt.registerTask('copy_build:dev', ['copy:es6_dev', 'copy:es6_devmap', 'copy:js_dev', 'copy:angular', 'copy:css_dev', 'copy:fonts_dev', 'clean']); // register default task diff --git a/examples/blog/config.js b/examples/blog/config.js index 554a7030..42d2c6ba 100644 --- a/examples/blog/config.js +++ b/examples/blog/config.js @@ -4,7 +4,7 @@ var app = angular.module('myApp', ['ng-admin']); - app.config(function (NgAdminConfigurationProvider, RestangularProvider) { + app.config(['NgAdminConfigurationProvider', 'RestangularProvider', function (NgAdminConfigurationProvider, RestangularProvider) { var nga = NgAdminConfigurationProvider; function truncate(value) { @@ -276,7 +276,7 @@ ); nga.configure(admin); - }); + }]); app.directive('postLink', ['$location', function ($location) { return { @@ -333,7 +333,7 @@ '
Send
' + ''; - app.config(function ($stateProvider) { + app.config(['$stateProvider', function ($stateProvider) { $stateProvider.state('send-post', { parent: 'main', url: '/sendPost/:id', @@ -342,7 +342,7 @@ controllerAs: 'controller', template: sendPostControllerTemplate }); - }); + }]); // custom page with menu item var customPageTemplate = '
' + @@ -352,12 +352,12 @@ '

You can add custom pages, too

' + '
' + '
'; - app.config(function ($stateProvider) { + app.config(['$stateProvider', function ($stateProvider) { $stateProvider.state('stats', { parent: 'main', url: '/stats', template: customPageTemplate }); - }); + }]); }()); diff --git a/examples/blog/index.html b/examples/blog/index.html index 200e1bcc..3f950748 100644 --- a/examples/blog/index.html +++ b/examples/blog/index.html @@ -9,7 +9,7 @@ - +
diff --git a/src/javascripts/ng-admin.js b/src/javascripts/ng-admin.js index 1945ac73..c64f5590 100644 --- a/src/javascripts/ng-admin.js +++ b/src/javascripts/ng-admin.js @@ -62,7 +62,8 @@ define(function (require) { factory.constant('AdminDescription', new AdminDescription()); var ngadmin = angular.module('ng-admin', ['main', 'crud', 'AdminDescriptionModule']); - ngadmin.config(function(NgAdminConfigurationProvider, AdminDescription) { + ngadmin.config(['NgAdminConfigurationProvider', 'AdminDescription', '$compileProvider', function(NgAdminConfigurationProvider, AdminDescription, $compileProvider) { + $compileProvider.debugInfoEnabled(false); NgAdminConfigurationProvider.setAdminDescription(AdminDescription); - }); + }]); }); diff --git a/src/javascripts/test/protractor.conf.js b/src/javascripts/test/protractor.conf.js index 1b07ad1b..12479f3f 100644 --- a/src/javascripts/test/protractor.conf.js +++ b/src/javascripts/test/protractor.conf.js @@ -20,5 +20,9 @@ exports.config = { showColors: true, includeStackTrace: true, defaultTimeoutInterval: 360000 + }, + + onPrepare: function () { + browser.executeScript('window.name = "NG_ENABLE_DEBUG_INFO"'); } };