You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
4.1 KiB

7 years ago
  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 sass = require('gulp-sass');
  6. var theme = {};
  7. theme.global = {};
  8. theme.desktop = {};
  9. theme.mobile = {};
  10. theme.admin = {};
  11. // PC용 테마용 파일들
  12. theme.desktop.title = "desktop";
  13. theme.desktop.css = [
  14. "node_modules/bootstrap/dist/css/bootstrap.css",
  15. "_src/desktop/scss/desktop.scss"
  16. ];
  17. theme.desktop.js = [
  18. "node_modules/bootstrap/dist/js/bootstrap.js",
  19. ];
  20. // 모바일 테마용 파일들
  21. theme.mobile.title = "mobile";
  22. theme.mobile.css = [
  23. ];
  24. theme.mobile.js = [
  25. ];
  26. // 관리자 페이지용 파일들
  27. theme.admin.title = "admin";
  28. theme.admin.css = [
  29. "_src/plugins/jquery-ui-1.12.1.custom/jquery-ui.css",
  30. "node_modules/bootstrap/dist/css/bootstrap.css",
  31. "_src/plugins/fontawesome5/fontawesome.scss",
  32. "_src/plugins/fontawesome5/fa-regular.scss",
  33. "node_modules/ax5ui-modal/dist/ax5modal.css",
  34. "node_modules/ax5ui-mask/dist/ax5mask.css",
  35. "_src/admin/scss/admin.scss"
  36. ];
  37. theme.admin.js = [
  38. "node_modules/bootstrap/dist/js/bootstrap.js",
  39. "node_modules/ax5core/dist/ax5core.js",
  40. "node_modules/ax5ui-mask/dist/ax5mask.js",
  41. "node_modules/ax5ui-modal/dist/ax5modal.js",
  42. "node_modules/nicescroll/dist/jquery.nicescroll.js",
  43. "_src/plugins/jquery-ui-1.12.1.custom/jquery-ui.js",
  44. "_src/admin/js/jquery.formatter.js",
  45. "_src/admin/js/jquery.tmpl.js",
  46. "_src/admin/js/admin.js",
  47. "_src/admin/js/modules/board.js",
  48. "_src/admin/js/modules/faq.js",
  49. "_src/admin/js/modules/member.js",
  50. ];
  51. // 공용으로 로드할 파일들
  52. theme.global.css = [
  53. "node_modules/reset-css/reset.css",
  54. "_src/common/css/global.css",
  55. "_src/common/css/toastr.css",
  56. ];
  57. theme.global.js = [
  58. "node_modules/jquery/dist/jquery.js",
  59. "_src/common/js/jquery.blockUI.js",
  60. "_src/common/js/jquery.cookie.js",
  61. "_src/common/js/toastr.js",
  62. "_src/common/js/global.js",
  63. "_src/common/js/member.js",
  64. "_src/common/js/board.js",
  65. ];
  66. gulp.task('minify-desktop-css', function () {
  67. return gulp.src( theme.global.css.concat(theme.desktop.css))
  68. .pipe(sass({outputStyle: 'compact'}))
  69. .pipe(concat( theme.desktop.title + '.min.css')) //병합하고
  70. .pipe(minifycss().on('error', function(e){console.log(e);}))
  71. .pipe(gulp.dest('public_html/assets/css'));
  72. });
  73. // Javascript 합치기 실행
  74. gulp.task('minify-desktop-js', [], function(){
  75. return gulp.src( theme.global.js.concat(theme.desktop.js))
  76. .pipe(uglify())
  77. .pipe(concat( theme.desktop.title + '.min.js'))
  78. .pipe(gulp.dest('public_html/assets/js'));
  79. });
  80. gulp.task('minify-mobile-css', function () {
  81. return gulp.src( theme.global.css.concat(theme.mobile.css))
  82. .pipe(sass({outputStyle: 'compact'}))
  83. .pipe(concat( theme.mobile.title + '.min.css')) //병합하고
  84. .pipe(minifycss().on('error', function(e){console.log(e);}))
  85. .pipe(gulp.dest('public_html/assets/css'));
  86. });
  87. gulp.task('minify-mobile-js', [], function(){
  88. return gulp.src( theme.global.js.concat(theme.mobile.js))
  89. .pipe(uglify())
  90. .pipe(concat( theme.mobile.title + '.min.js'))
  91. .pipe(gulp.dest('public_html/assets/js'));
  92. });
  93. gulp.task('minify-admin-css', function () {
  94. return gulp.src( theme.global.css.concat(theme.admin.css))
  95. .pipe(sass({outputStyle: 'compact'}))
  96. .pipe(concat( theme.admin.title + '.min.css')) //병합하고
  97. .pipe(minifycss().on('error', function(e){console.log(e);}))
  98. .pipe(gulp.dest('public_html/assets/css'));
  99. });
  100. gulp.task('minify-admin-js', [], function(){
  101. return gulp.src( theme.global.js.concat( theme.admin.js))
  102. .pipe(uglify())
  103. .pipe(concat( theme.admin.title + '.min.js'))
  104. .pipe(gulp.dest('public_html/assets/js'));
  105. });
  106. gulp.task('mobile-minify', ['minify-mobile-js', 'minify-mobile-css']);
  107. gulp.task('desktop-minify', ['minify-desktop-js', 'minify-desktop-css']);
  108. gulp.task('admin-minify', ['minify-admin-js', 'minify-admin-css']);
  109. gulp.task('default', ['minify-desktop-js', 'minify-desktop-css', 'minify-mobile-js', 'minify-mobile-css','minify-admin-js', 'minify-admin-css']);