Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Commit

Permalink
Added gulp clean tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-marshall committed Jan 12, 2016
1 parent 2aa6427 commit 71e2220
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
28 changes: 25 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var merge = require('merge-stream');
var sequence = require('run-sequence');
var colors = require('colors');
var dateFormat = require('dateformat');
var del = require('del');

// Enter URL of your local server here
// Example: 'http://localwebsite.dev'
Expand Down Expand Up @@ -184,7 +185,7 @@ gulp.task('package', ['build'], function() {

// Build task
// Runs copy then runs sass & javascript in parallel
gulp.task('build', function(done) {
gulp.task('build', ['clean'], function(done) {
sequence('copy',
['sass', 'javascript', 'lint'],
done);
Expand Down Expand Up @@ -213,6 +214,27 @@ gulp.task('phpcbf', function () {
.pipe(gulp.dest('.'));
});

// Clean task
gulp.task('clean', function(done) {
sequence(['clean:javascript', 'clean:css'],
done);
});

// Clean JS
gulp.task('clean:javascript', function() {
return del([
'assets/javascript/foundation.js'
]);
});

// Clean CSS
gulp.task('clean:css', function() {
return del([
'assets/stylesheets/foundation.css',
'assets/stylesheets/foundation.css.map'
]);
});

// Default gulp task
// Run build task and watch for file changes
gulp.task('default', ['build', 'browser-sync'], function() {
Expand All @@ -223,13 +245,13 @@ gulp.task('default', ['build', 'browser-sync'], function() {
}

// Sass Watch
gulp.watch(['assets/scss/**/*.scss'], ['sass'])
gulp.watch(['assets/scss/**/*.scss'], ['clean:css', 'sass'])
.on('change', function(event) {
logFileChange(event);
});

// JS Watch
gulp.watch(['assets/javascript/custom/**/*.js'], ['javascript', 'lint'])
gulp.watch(['assets/javascript/custom/**/*.js'], ['clean:javscript', 'javascript', 'lint'])
.on('change', function(event) {
logFileChange(event);
});
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"browser-sync": "^2.10.0",
"colors": "^1.1.2",
"dateformat": "^1.0.12",
"del": "^2.2.0",
"gulp": "^3.9.0",
"gulp-autoprefixer": "^3.1.0",
"gulp-concat": "^2.6.0",
Expand Down

0 comments on commit 71e2220

Please sign in to comment.