Add uglify to grunt tasks

This commit is contained in:
Frédéric Vachon 2015-02-20 13:39:16 -05:00
parent a838a6779a
commit 62f092db99
5 changed files with 55 additions and 49 deletions

1
.gitignore vendored
View File

@ -13,3 +13,4 @@ tmp
app/assets/css app/assets/css
.sass-cache/ .sass-cache/
out/ out/
build/

View File

@ -2,10 +2,6 @@
module.exports = function (grunt) { module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-jslint');
grunt.initConfig({ grunt.initConfig({
pkg: grunt.file.readJSON('package.json'), pkg: grunt.file.readJSON('package.json'),
@ -72,8 +68,53 @@ module.exports = function (grunt) {
checkstyle: 'out/client-checkstyle.xml' // write a checkstyle-XML checkstyle: 'out/client-checkstyle.xml' // write a checkstyle-XML
} }
} }
},
// Minify and concatenate adagios in one file
uglify: {
compress: {
files: [{
'app/build/js/adagios.js' : [
'app/app.js',
'app/components/config/config.js',
'app/components/live/live.js',
'app/components/live/notifications.js',
'app/components/live/get_services.js',
'app/components/ng-justgage/ng-justgage.js',
'app/components/filters/filters.js',
'app/components/sidebar/sidebar.js',
'app/components/topbar/topbar.js',
'app/components/tactical/tactical.js',
'app/components/tactical/status_overview/status_overview.js',
'app/components/tactical/current_health/current_health.js',
'app/components/tactical/top_alert_producers/top_alert_producers.js',
'app/components/table/table.js',
'app/components/table/cell_duration/cell_duration.js',
'app/components/table/cell_host/cell_host.js',
'app/components/table/cell_last_check/cell_last_check.js',
'app/components/table/cell_service_check/cell_service_check.js',
'app/components/table/cell_hosts_host/cell_hosts_host.js',
'app/components/table/cell_host_address/cell_host_address.js',
'app/components/table/cell_host_status/cell_host_status.js',
'app/dashboard/dashboard.js',
'app/hosts/hosts.js',
'app/services/services.js',
'app/custom_views/custom_views.js',
// Excluded files/directories
'!app/bower_components/**',
'!app/build/**',
'!app/**/*_test.js'
]
}]
}
} }
}); });
grunt.registerTask('default', [ 'watch', 'jslint' ]); grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-jslint');
grunt.registerTask('default', [ 'watch', 'jslint' , 'uglify']);
}; };

View File

@ -72,7 +72,7 @@ angular.module('adagios.table', ['adagios.live',
}; };
}]) }])
.directive('adgCell', function ($http, $compile, $templateCache) { .directive('adgCell', ['$http', '$compile', function ($http, $compile) {
return { return {
restrict: 'A', restrict: 'A',
@ -93,4 +93,4 @@ angular.module('adagios.table', ['adagios.live',
}; };
} }
}; };
}); }]);

View File

@ -16,51 +16,14 @@
<script src="bower_components/angular/angular.js"></script> <script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script> <script src="bower_components/angular-route/angular-route.js"></script>
<!-- Application -->
<script src="app.js"></script>
<script src="components/config/config.js"></script>
<!-- COMPONENTS -->
<script src="components/live/live.js"></script>
<script src="components/live/notifications.js"></script>
<script src="components/live/get_services.js"></script>
<script src="components/ng-justgage/ng-justgage.js"></script>
<script src="components/filters/filters.js"></script>
<!-- MODULES -->
<script src="components/sidebar/sidebar.js"></script>
<script src="components/topbar/topbar.js"></script>
<script src="components/tactical/tactical.js"></script>
<script src="components/tactical/status_overview/status_overview.js"></script>
<script src="components/tactical/current_health/current_health.js"></script>
<script src="components/tactical/top_alert_producers/top_alert_producers.js"></script>
<script src="components/table/table.js"></script>
<script src="components/table/cell_duration/cell_duration.js"></script>
<script src="components/table/cell_host/cell_host.js"></script>
<script src="components/table/cell_last_check/cell_last_check.js"></script>
<script src="components/table/cell_service_check/cell_service_check.js"></script>
<script src="components/table/cell_hosts_host/cell_hosts_host.js"></script>
<script src="components/table/cell_host_address/cell_host_address.js"></script>
<script src="components/table/cell_host_status/cell_host_status.js"></script>
<script src="bower_components/html5-boilerplate/js/vendor/modernizr-2.6.2.min.js"></script> <script src="bower_components/html5-boilerplate/js/vendor/modernizr-2.6.2.min.js"></script>
<script src="bower_components/moment/moment.js"></script> <script src="bower_components/moment/moment.js"></script>
<!-- VIEWS --> <script src="build/js/compressed.js"></script>
<script src="dashboard/dashboard.js"></script>
<script src="hosts/hosts.js"></script>
<script src="services/services.js"></script>
<script src="custom_views/custom_views.js"></script>
</head> </head>
<body class="layout color-scheme--dark"> <body class="layout color-scheme--dark">
<!--[if lt IE 7]> <!--[if lt IE 7]> <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> <![endif]-->
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div class="layout__container"> <div class="layout__container">
<aside class="layout__aside sidebar-wrapper collapse" id="sidebarWrapper"> <aside class="layout__aside sidebar-wrapper collapse" id="sidebarWrapper">
<adg-sidebar></adg-sidebar> <adg-sidebar></adg-sidebar>

View File

@ -16,7 +16,8 @@
"karma": "~0.10", "karma": "~0.10",
"karma-junit-reporter": "^0.2.2", "karma-junit-reporter": "^0.2.2",
"protractor": "^1.1.1", "protractor": "^1.1.1",
"shelljs": "^0.2.6" "shelljs": "^0.2.6",
"grunt-contrib-uglify": "~0.8.0"
}, },
"scripts": { "scripts": {
"postinstall": "bower install", "postinstall": "bower install",