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.

124 lines
4.2 KiB

  1. /*******************************
  2. Internal Task Collection
  3. *******************************/
  4. /* These tasks create packaged files from **dist** components
  5. Not intended to be called directly by a user because
  6. these do not build fresh from **src**
  7. */
  8. module.exports = function(gulp) {
  9. var
  10. // node dependencies
  11. fs = require('fs'),
  12. chmod = require('gulp-chmod'),
  13. concat = require('gulp-concat'),
  14. concatCSS = require('gulp-concat-css'),
  15. clone = require('gulp-clone'),
  16. gulpif = require('gulp-if'),
  17. header = require('gulp-header'),
  18. less = require('gulp-less'),
  19. minifyCSS = require('gulp-minify-css'),
  20. plumber = require('gulp-plumber'),
  21. print = require('gulp-print'),
  22. rename = require('gulp-rename'),
  23. replace = require('gulp-replace'),
  24. uglify = require('gulp-uglify'),
  25. // docs config
  26. config = require('./../config/docs'),
  27. // install config
  28. tasks = require('./../config/project/tasks'),
  29. release = require('./../config/project/release'),
  30. // shorthand
  31. globs = config.globs,
  32. assets = config.paths.assets,
  33. output = config.paths.output,
  34. source = config.paths.source,
  35. banner = tasks.banner,
  36. filenames = tasks.filenames,
  37. log = tasks.log,
  38. settings = tasks.settings
  39. ;
  40. /*--------------
  41. Packaged
  42. ---------------*/
  43. gulp.task('package uncompressed docs css', function() {
  44. return gulp.src(output.uncompressed + '**/' + globs.components + globs.ignored + '.css')
  45. .pipe(plumber())
  46. .pipe(replace(assets.uncompressed, assets.packaged))
  47. .pipe(concatCSS(filenames.concatenatedCSS))
  48. .pipe(gulpif(config.hasPermission, chmod(config.permission)))
  49. .pipe(gulp.dest(output.packaged))
  50. .pipe(print(log.created))
  51. ;
  52. });
  53. gulp.task('package compressed docs css', function() {
  54. return gulp.src(output.uncompressed + '**/' + globs.components + globs.ignored + '.css')
  55. .pipe(plumber())
  56. .pipe(replace(assets.uncompressed, assets.packaged))
  57. .pipe(concatCSS(filenames.concatenatedMinifiedCSS))
  58. .pipe(minifyCSS(settings.minify))
  59. .pipe(header(banner, settings.header))
  60. .pipe(gulpif(config.hasPermission, chmod(config.permission)))
  61. .pipe(gulp.dest(output.packaged))
  62. .pipe(print(log.created))
  63. ;
  64. });
  65. gulp.task('package uncompressed docs js', function() {
  66. return gulp.src(output.uncompressed + '**/' + globs.components + globs.ignored + '.js')
  67. .pipe(plumber())
  68. .pipe(replace(assets.uncompressed, assets.packaged))
  69. .pipe(concat(filenames.concatenatedJS))
  70. .pipe(header(banner, settings.header))
  71. .pipe(gulpif(config.hasPermission, chmod(config.permission)))
  72. .pipe(gulp.dest(output.packaged))
  73. .pipe(print(log.created))
  74. ;
  75. });
  76. gulp.task('package compressed docs js', function() {
  77. return gulp.src(output.uncompressed + '**/' + globs.components + globs.ignored + '.js')
  78. .pipe(plumber())
  79. .pipe(replace(assets.uncompressed, assets.packaged))
  80. .pipe(concat(filenames.concatenatedMinifiedJS))
  81. .pipe(uglify(settings.uglify))
  82. .pipe(header(banner, settings.header))
  83. .pipe(gulpif(config.hasPermission, chmod(config.permission)))
  84. .pipe(gulp.dest(output.packaged))
  85. .pipe(print(log.created))
  86. ;
  87. });
  88. /*--------------
  89. RTL
  90. ---------------*/
  91. gulp.task('package uncompressed docs rtl css', function () {
  92. return gulp.src(output.uncompressed + '**/' + globs.components + globs.ignoredRTL + '.rtl.css')
  93. .pipe(replace(assets.uncompressed, assets.packaged))
  94. .pipe(concatCSS(filenames.concatenatedRTLCSS))
  95. .pipe(gulp.dest(output.packaged))
  96. .pipe(print(log.created))
  97. ;
  98. });
  99. gulp.task('package compressed rtl css', function () {
  100. return gulp.src(output.uncompressed + '**/' + globs.components + globs.ignoredRTL + '.rtl.css')
  101. .pipe(replace(assets.uncompressed, assets.packaged))
  102. .pipe(concatCSS(filenames.concatenatedMinifiedRTLCSS))
  103. .pipe(minifyCSS(settings.minify))
  104. .pipe(header(banner, settings.header))
  105. .pipe(gulp.dest(output.packaged))
  106. .pipe(print(log.created))
  107. ;
  108. });
  109. };