build_task.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. 'jscs',
  8. 'karma:test',
  9. 'clean:on_start',
  10. 'less:src',
  11. 'concat:cssDark',
  12. 'concat:cssLight',
  13. 'copy:everything_but_less_to_temp',
  14. 'htmlmin:build',
  15. 'ngtemplates',
  16. 'cssmin:build',
  17. 'ngAnnotate:build',
  18. 'requirejs:build',
  19. 'concat:js',
  20. 'filerev',
  21. 'usemin',
  22. 'clean:temp',
  23. 'uglify:dest'
  24. ]);
  25. grunt.registerTask('build-post-process', function() {
  26. grunt.config('copy.dist_to_tmp', {
  27. expand: true,
  28. cwd: '<%= destDir %>',
  29. src: '**/*',
  30. dest: '<%= tempDir %>/public/',
  31. });
  32. grunt.config('clean.dest_dir', ['<%= destDir %>']);
  33. grunt.config('copy.backend_bin', {
  34. cwd: 'bin',
  35. expand: true,
  36. src: ['grafana'],
  37. options: { mode: true},
  38. dest: '<%= tempDir %>'
  39. });
  40. grunt.config('copy.backend_files', {
  41. expand: true,
  42. src: ['conf/defaults.ini', 'conf/sample.ini', 'vendor/**/*', 'scripts/*'],
  43. options: { mode: true},
  44. dest: '<%= tempDir %>'
  45. });
  46. grunt.task.run('copy:dist_to_tmp');
  47. grunt.task.run('clean:dest_dir');
  48. grunt.task.run('copy:backend_bin');
  49. grunt.task.run('copy:backend_files');
  50. });
  51. };