blob: 38a17ce2956eccc76d8150f4bc9c87bdcc816db7 [file] [log] [blame]
Iftekharul Islam532763f2017-04-25 09:44:40 -05001
2/*eslint-env node */
3/*global require: true, module: true */
4
5'use strict';
6
7var options = require('../gulp-options.js'),
8 gulp = require('gulp'),
9
10 // Base dependencies
11 clean = require('gulp-clean'),
12 rename = require('gulp-rename'),
13
14 // Classical gulp dependencies
15 uglify = require('gulp-uglify');
16
17var runSequence = require('run-sequence');
18
19gulp.task('minifyvendorjs:clean', function () {
20 return gulp.src(options.bowerFolderPath + '/**/*.min.js', {read: false})
21 .pipe(clean());
22});
23
24gulp.task('minifyvendorjs:minify', function () {
25 return gulp
26 .src(options.bowerFolderPath + '/**/*.js')
27 .pipe(uglify({
28 preserveComments: 'false'
29 }))
30 .pipe(rename({suffix: '.min'}))
31 .pipe(gulp.dest(function(file) {
32 return file.base;
33 }))
34});
35
36module.exports = function (callback) {
37 return runSequence(
38 'minifyvendorjs:clean',
39 'minifyvendorjs:minify',
40 callback
41 );
42};