From e1f9fdc2c83d0b15286aeb8f39be34e8612e2ec3 Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Tue, 14 Aug 2018 09:33:19 +0530 Subject: Adds gulp task to remove folders. :lipstick: * Previously most of the temp folder will become a gunk yard if libraries are removed & new one's are added, effect is final archive.zip size is huge because it contains stray files. --- gulpfile.js | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'gulpfile.js') diff --git a/gulpfile.js b/gulpfile.js index 0bb7f86..2fc8d42 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,18 +1,20 @@ 'use strict'; -var gulp = require('gulp'); -var browserSync = require('browser-sync'); -var uglify = require('gulp-uglify'); -var zip = require('gulp-vinyl-zip').zip; -var size = require('gulp-size'); -var runSequence = require('run-sequence'); -let rollup = require('rollup-stream'); - -var source = require('vinyl-source-stream'); -var libs = ['./node_modules/kontra/kontra.min.js', './node_modules/tinymusic/dist/TinyMusic.min.js']; -var devLibs = ['./node_modules/jsfxr/jsfxr.js']; -var libFolder = 'libs/'; -var outputTemp = 'temp/'; +const gulp = require('gulp'); +const browserSync = require('browser-sync'); +const uglify = require('gulp-uglify'); +const zip = require('gulp-vinyl-zip').zip; +const size = require('gulp-size'); +const runSequence = require('run-sequence'); +const rollup = require('rollup-stream'); +const del = require('del'); + + +const source = require('vinyl-source-stream'); +const libs = ['./node_modules/kontra/kontra.min.js', './node_modules/tinymusic/dist/TinyMusic.min.js']; +const devLibs = ['./node_modules/jsfxr/jsfxr.js']; +const libFolder = 'libs/'; +const outputTemp = 'temp/'; gulp.task('serve', ['copylibs', 'copylibsDev', 'uglyfy_copy'], function () { browserSync.init({ @@ -32,6 +34,11 @@ gulp.task('reload', function () { browserSync.reload(); }); +gulp.task('delete_folders', function(){ + return del(['libs/','public/','temp/','dist/']).then(function(paths){ + console.log('Deleted Files & folders ',paths); + }); +}); gulp.task('uglyfy_copy', function () { return rollup({ @@ -74,5 +81,5 @@ gulp.task('prepare_dist_folder', function () { }); gulp.task('release', function () { - runSequence('copylibs', 'copylibsDev', 'uglyfy_copy', 'prepare_dist_folder', 'zipFiles'); + runSequence('delete_folders','copylibs', 'copylibsDev', 'uglyfy_copy', 'prepare_dist_folder', 'zipFiles'); }); -- cgit v1.2.3