Iftekharul Islam | 532763f | 2017-04-25 09:44:40 -0500 | [diff] [blame^] | 1 | |
| 2 | /*eslint-env node */ |
| 3 | /*global require: true, module: true */ |
| 4 | |
| 5 | 'use strict'; |
| 6 | |
| 7 | var 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 | |
| 17 | var runSequence = require('run-sequence'); |
| 18 | |
| 19 | gulp.task('minifyvendorjs:clean', function () { |
| 20 | return gulp.src(options.bowerFolderPath + '/**/*.min.js', {read: false}) |
| 21 | .pipe(clean()); |
| 22 | }); |
| 23 | |
| 24 | gulp.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 | |
| 36 | module.exports = function (callback) { |
| 37 | return runSequence( |
| 38 | 'minifyvendorjs:clean', |
| 39 | 'minifyvendorjs:minify', |
| 40 | callback |
| 41 | ); |
| 42 | }; |