build_task.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. module.exports = function(grunt) {
  2. "use strict";
  3. // Concat and Minify the src directory into dist
  4. grunt.registerTask('build', [
  5. 'jshint:source',
  6. 'jshint:tests',
  7. 'karma:test',
  8. 'clean:on_start',
  9. 'less:src',
  10. 'concat:cssDark',
  11. 'concat:cssLight',
  12. 'copy:everything_but_less_to_temp',
  13. 'htmlmin:build',
  14. 'ngtemplates',
  15. 'cssmin:build',
  16. 'ngAnnotate:build',
  17. 'requirejs:build',
  18. 'concat:js',
  19. 'filerev',
  20. 'usemin',
  21. 'clean:temp',
  22. 'uglify:dest'
  23. ]);
  24. grunt.registerTask('build-post-process', function() {
  25. grunt.config('copy.dist_to_tmp', {
  26. expand: true,
  27. cwd: '<%= destDir %>',
  28. src: '**/*',
  29. dest: '<%= tempDir %>/public/',
  30. });
  31. grunt.config('clean.dest_dir', ['<%= destDir %>']);
  32. grunt.config('copy.backend_bin', {
  33. cwd: 'bin',
  34. expand: true,
  35. src: ['grafana'],
  36. options: { mode: true},
  37. dest: '<%= tempDir %>'
  38. });
  39. grunt.config('copy.backend_files', {
  40. expand: true,
  41. src: ['conf/defaults.ini', 'vendor/**/*', 'scripts/*'],
  42. options: { mode: true},
  43. dest: '<%= tempDir %>'
  44. });
  45. grunt.task.run('copy:dist_to_tmp');
  46. grunt.task.run('clean:dest_dir');
  47. grunt.task.run('copy:backend_bin');
  48. grunt.task.run('copy:backend_files');
  49. });
  50. };