Iftekharul Islam | 532763f | 2017-04-25 09:44:40 -0500 | [diff] [blame] | 1 | /*eslint-env node */ |
| 2 | /*global require: true, module: true */ |
| 3 | |
| 4 | 'use strict'; |
| 5 | |
Andrew Geissler | 7d6e629 | 2018-05-24 12:06:58 -0700 | [diff] [blame] | 6 | var options = require('../gulp-options.js'), gulp = require('gulp'), |
Iftekharul Islam | 532763f | 2017-04-25 09:44:40 -0500 | [diff] [blame] | 7 | |
| 8 | // Base dependencies |
Andrew Geissler | 7d6e629 | 2018-05-24 12:06:58 -0700 | [diff] [blame] | 9 | clean = require('gulp-clean'), rename = require('gulp-rename'), |
Iftekharul Islam | 532763f | 2017-04-25 09:44:40 -0500 | [diff] [blame] | 10 | |
| 11 | // Classical gulp dependencies |
| 12 | uglify = require('gulp-uglify'); |
| 13 | |
| 14 | var runSequence = require('run-sequence'); |
| 15 | |
Andrew Geissler | 7d6e629 | 2018-05-24 12:06:58 -0700 | [diff] [blame] | 16 | gulp.task('minifyvendorjs:clean', function() { |
Iftekharul Islam | 532763f | 2017-04-25 09:44:40 -0500 | [diff] [blame] | 17 | return gulp.src(options.bowerFolderPath + '/**/*.min.js', {read: false}) |
Andrew Geissler | 7d6e629 | 2018-05-24 12:06:58 -0700 | [diff] [blame] | 18 | .pipe(clean()); |
Iftekharul Islam | 532763f | 2017-04-25 09:44:40 -0500 | [diff] [blame] | 19 | }); |
| 20 | |
Andrew Geissler | 7d6e629 | 2018-05-24 12:06:58 -0700 | [diff] [blame] | 21 | gulp.task('minifyvendorjs:minify', function() { |
| 22 | return gulp.src(options.bowerFolderPath + '/**/*.js') |
| 23 | .pipe(uglify({preserveComments: 'false'})) |
| 24 | .pipe(rename({suffix: '.min'})) |
| 25 | .pipe(gulp.dest(function(file) { |
| 26 | return file.base; |
| 27 | })); |
Iftekharul Islam | 532763f | 2017-04-25 09:44:40 -0500 | [diff] [blame] | 28 | }); |
| 29 | |
Andrew Geissler | 7d6e629 | 2018-05-24 12:06:58 -0700 | [diff] [blame] | 30 | module.exports = function(callback) { |
| 31 | return runSequence('minifyvendorjs:clean', 'minifyvendorjs:minify', callback); |
| 32 | }; |