blob: 8c429a3d71c0fffaa56fd36c546150fbaed4befc [file] [log] [blame]
Iftekharul Islam532763f2017-04-25 09:44:40 -05001/*eslint-env node */
2/*global require: true, module: true */
3
4'use strict';
5
Andrew Geissler7d6e6292018-05-24 12:06:58 -07006var options = require('../gulp-options.js'), gulp = require('gulp'),
Iftekharul Islam532763f2017-04-25 09:44:40 -05007
8 // Base dependencies
Andrew Geissler7d6e6292018-05-24 12:06:58 -07009 clean = require('gulp-clean'), rename = require('gulp-rename'),
Iftekharul Islam532763f2017-04-25 09:44:40 -050010
11 // Classical gulp dependencies
12 uglify = require('gulp-uglify');
13
14var runSequence = require('run-sequence');
15
Andrew Geissler7d6e6292018-05-24 12:06:58 -070016gulp.task('minifyvendorjs:clean', function() {
Iftekharul Islam532763f2017-04-25 09:44:40 -050017 return gulp.src(options.bowerFolderPath + '/**/*.min.js', {read: false})
Andrew Geissler7d6e6292018-05-24 12:06:58 -070018 .pipe(clean());
Iftekharul Islam532763f2017-04-25 09:44:40 -050019});
20
Andrew Geissler7d6e6292018-05-24 12:06:58 -070021gulp.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 Islam532763f2017-04-25 09:44:40 -050028});
29
Andrew Geissler7d6e6292018-05-24 12:06:58 -070030module.exports = function(callback) {
31 return runSequence('minifyvendorjs:clean', 'minifyvendorjs:minify', callback);
32};