diff --git a/src/gulpfile.js b/src/gulpfile.js index c244e76f..d503aa73 100644 --- a/src/gulpfile.js +++ b/src/gulpfile.js @@ -7,6 +7,7 @@ var fs = require('fs'), lodash = require('lodash'), PoFile = require('pofile'), strftime = require('strftime'), + del = require('del'), bower = require('bower'), gulp = require('gulp'), uglify = require('gulp-uglify'), @@ -44,6 +45,21 @@ var config = { } +// Cleans all built files +gulp.task('clean', function(callback) { + del([ + 'release', + 'composer.lock', + config.phpVendorPath, + config.jsVendorPath, + config.jsPath + '/compiled/**/*.*', + '!' + config.jsPath + '/compiled/.keep', + config.chatStylesPath + '/default/templates_compiled/client_side/*.js', + config.chatStylesPath + '/default/js/compiled/*.js', + config.pageStylesPath + '/default/templates_compiled/client_side/*.js' + ], callback); +}); + // Checks all PHP files with PHP Code Sniffer. gulp.task('phpcs', ['composer-install-dev'], function() { return gulp.src([ @@ -323,6 +339,7 @@ gulp.task('pack-sources', ['composer-install', 'bower-install'], function() { // Performs all tasks in the correct order. gulp.task('prepare-release', function(callback) { runSequence( + 'clean', ['phpcs', 'js', 'chat-styles', 'page-styles', 'generate-pot'], 'pack-sources', callback diff --git a/src/package.json b/src/package.json index d36c81ba..e100db79 100644 --- a/src/package.json +++ b/src/package.json @@ -22,6 +22,7 @@ "pofile": "~0.2.12", "lodash": "~2.4.1", "strftime": "~0.8.2", + "del": "~1.1.1", "event-stream": "~3.2.1" } }