gulpfile.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. 'use strict';
  2. const gulp = require('gulp');
  3. const concat = require('gulp-concat');
  4. const uglify = require('gulp-uglify');
  5. const minifycss = require('gulp-minify-css');
  6. const adminPath = 'public/static/admin/';
  7. const balticrestPath = 'public/static/balticrest/';
  8. // ==================================================== Admin CSS ======================================================
  9. gulp.task('admin:css:main', function() {
  10. return gulp.src([
  11. adminPath + 'src/bootstrap/css/bootstrap.min.css',
  12. adminPath + 'src/font-awesome/css/font-awesome.css',
  13. adminPath + 'src/light-bootstrap/css/light-bootstrap-dashboard.css'
  14. ])
  15. .pipe(minifycss())
  16. .pipe(concat('admin_main.css'))
  17. .pipe(gulp.dest(adminPath + 'build'));
  18. });
  19. gulp.task('admin:css:elfinder', function() {
  20. return gulp.src([
  21. adminPath + 'src/jquery-ui/jquery-ui.css',
  22. adminPath + 'src/jquery-ui/jquery-ui.theme.css',
  23. adminPath + 'src/elfinder/css/elfinder.full.css',
  24. adminPath + 'src/elfinder/css/theme.css'
  25. ])
  26. .pipe(minifycss())
  27. .pipe(concat('admin_elfinder.css'))
  28. .pipe(gulp.dest(adminPath + 'build'));
  29. });
  30. // ==================================================== Admin JS =======================================================
  31. gulp.task('admin:js:main', function() {
  32. return gulp.src([
  33. adminPath + 'src/jquery/js/jquery.min.js',
  34. adminPath + 'src/bootstrap/js/bootstrap.bundle.min.js',
  35. adminPath + 'src/bootstrap/js/bootstrap-datepicker.js',
  36. adminPath + 'src/bootstrap/js/bootstrap-notify.js',
  37. adminPath + 'src/bootstrap/js/bootstrap-switch.js',
  38. adminPath + 'src/light-bootstrap/js/light-bootstrap-dashboard.js'
  39. ])
  40. .pipe(uglify())
  41. .pipe(concat('admin_main.js'))
  42. .pipe(gulp.dest(adminPath + 'build'));
  43. });
  44. gulp.task('admin:js:elfinder', function() {
  45. return gulp.src([
  46. adminPath + 'src/elfinder/js/elfinder.full.js',
  47. adminPath + 'src/elfinder/js/i18n/elfinder.ru.js',
  48. adminPath + 'src/jquery-ui/jquery-ui.js'
  49. ])
  50. .pipe(uglify())
  51. .pipe(concat('admin_elfinder.js'))
  52. .pipe(gulp.dest(adminPath + 'build'));
  53. });
  54. // ==================================================== Balticrest CSS ======================================================
  55. gulp.task('balticrest:css:main', function() {
  56. return gulp.src([
  57. balticrestPath + 'src/bootstrap/css/bootstrap.css',
  58. balticrestPath + 'src/pushy/css/pushy.css',
  59. balticrestPath + 'src/animate/css/animate.css',
  60. balticrestPath + 'src/font-awesome/css/font-awesome.css',
  61. balticrestPath + 'src/balticrest/css/main.css',
  62. balticrestPath + 'src/balticrest/css/adaptive.css'
  63. ])
  64. .pipe(minifycss())
  65. .pipe(concat('balticrest_main.css'))
  66. .pipe(gulp.dest(balticrestPath + 'build'));
  67. });
  68. gulp.task('balticrest:css:index', function() {
  69. return gulp.src([balticrestPath + 'src/jquery/css/settings.css'])
  70. .pipe(minifycss())
  71. .pipe(concat('balticrest_index.css'))
  72. .pipe(gulp.dest(balticrestPath + 'build'));
  73. });
  74. // ==================================================== Balticrest JS =======================================================
  75. gulp.task('balticrest:js:main', function() {
  76. return gulp.src([
  77. balticrestPath + 'src/jquery/js/jquery.min.js',
  78. balticrestPath + 'src/bootstrap/js/bootstrap.min.js',
  79. balticrestPath + 'src/balticrest/js/all_scr.js'
  80. ])
  81. .pipe(uglify())
  82. .pipe(concat('balticrest_main.js'))
  83. .pipe(gulp.dest(balticrestPath + 'build'));
  84. });
  85. gulp.task('balticrest:js:map', function() {
  86. return gulp.src([balticrestPath + 'src/balticrest/js/map.js'])
  87. .pipe(uglify())
  88. .pipe(concat('balticrest_map.js'))
  89. .pipe(gulp.dest(balticrestPath + 'build'));
  90. });
  91. gulp.task('balticrest:js:index', function() {
  92. return gulp.src([
  93. balticrestPath + 'src/jquery/js/jquery.parallax-0.2-min.js',
  94. balticrestPath + 'src/jquery/js/jquery.themepunch.revolution.min.js',
  95. balticrestPath + 'src/jquery/js/jquery.themepunch.tools.min.js',
  96. balticrestPath + 'src/wow/js/wow.min.js',
  97. balticrestPath + 'src/balticrest/js/index.js'
  98. ])
  99. .pipe(uglify())
  100. .pipe(concat('balticrest_index.js'))
  101. .pipe(gulp.dest(balticrestPath + 'build'));
  102. });
  103. // ===================================================== Main ==========================================================
  104. gulp.task('prod', gulp.parallel(
  105. 'admin:css:main', 'admin:js:main',
  106. 'admin:css:elfinder', 'admin:js:elfinder',
  107. 'balticrest:css:main', 'balticrest:js:main',
  108. 'balticrest:js:map',
  109. 'balticrest:css:index', 'balticrest:js:index'
  110. ));
  111. gulp.task('default', gulp.series('prod'));