gulpfile.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. var gulp = require('gulp');
  2. var concat = require('gulp-concat');
  3. var uglify = require('gulp-uglify');
  4. var minifyCSS = require('gulp-minify-css');
  5. var frontend_path = './frontend/';
  6. var extern_path = frontend_path + 'extern/';
  7. gulp.task('build-extern-js', function(){
  8. var extern = [
  9. 'jquery/jquery.min.js',
  10. 'jquery/jquery-ui.js',
  11. 'jquery/jquery.multiselect.min.js',
  12. 'jquery/jquery.ui.jrange.js',
  13. 'bootstrap/bootstrap.min.js',
  14. 'highcharts/highcharts.js',
  15. 'jvectormap/jquery-jvectormap.min.js',
  16. 'jvectormap/jquery-jvectormap-world-mill-en.js',
  17. 'leaflet/leaflet.js',
  18. 'globe/three.min.js',
  19. 'globe/globe.min.js',
  20. 'datatables/jquery.dataTables.min.js',
  21. 'datatables/DT_bootstrap.js',
  22. 'jquery/jquery.ba-throttle-debounce.min.js'
  23. ];
  24. return gulp.src(extern.map(function(f){
  25. return extern_path + f;
  26. })).pipe(concat('all-extern.js'))
  27. .pipe(uglify())
  28. .pipe(gulp.dest(frontend_path + 'build/'));
  29. });
  30. gulp.task('build-internal-js', function(){
  31. var intern = [
  32. 'countryName.js',
  33. 'map.js',
  34. 'streetmap.js',
  35. 'statistics.js',
  36. 'controller.js',
  37. 'world.js',
  38. 'dbWindow.js',
  39. 'help.js',
  40. 'menu.js',
  41. 'filter.js',
  42. 'main.js'
  43. ];
  44. return gulp.src(intern.map(function(f){
  45. return frontend_path + f;
  46. })).pipe(concat('all-intern.js'))
  47. .pipe(uglify())
  48. .pipe(gulp.dest(frontend_path + 'build/'));
  49. });
  50. gulp.task('build-external-css', function(){
  51. var extern = [
  52. 'jquery/jquery-ui.css',
  53. 'jquery/jquery.multiselect.css',
  54. 'jquery/ui.jrange.css',
  55. 'bootstrap/bootstrap.min.css',
  56. 'bootstrap/bootstrap-responsive.min.css',
  57. 'jvectormap/jquery-jvectormap.css',
  58. 'leaflet/leaflet.css',
  59. 'globe/globe.css',
  60. 'datatables/jquery.dataTables.css',
  61. 'datatables/DT_bootstrap.css'
  62. ];
  63. return gulp.src(extern.map(function(f){
  64. return extern_path + f;
  65. })).pipe(concat('all-extern.css'))
  66. .pipe(minifyCSS())
  67. .pipe(gulp.dest(frontend_path + 'build/'));
  68. });
  69. gulp.task('build-internal-css', function(){
  70. return gulp.src(frontend_path + 'main.css')
  71. .pipe(minifyCSS())
  72. .pipe(gulp.dest(frontend_path + 'build/'));
  73. });
  74. gulp.task('default', ['build-extern-js', 'build-internal-js', 'build-external-css', 'build-internal-css']);