From f4de17acf538aa942a064953ea37b98c94d2122f Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 28 May 2016 08:35:14 +0100 Subject: [PATCH] Gulp cleanup --- gulp/clean.js | 6 ++++-- gulp/fonts.js | 2 +- gulp/scripts.js | 13 +++++-------- gulp/styles.js | 4 ++-- gulp/watch.js | 7 ++++--- gulpfile.js | 22 +++++++++++----------- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/gulp/clean.js b/gulp/clean.js index ea3bd957..864a53e6 100644 --- a/gulp/clean.js +++ b/gulp/clean.js @@ -1,6 +1,8 @@ var del = require('del'); gulp.task('clean', function () { - del.sync(config.outputDir + '/{css,js}'); - del.sync('output_*/assets/{css,js}'); + del.sync(config.fonts.outputDir); + del.sync(config.js.outputDir); + del.sync(config.sass.outputDir); + del.sync('output_*/assets/{css,fonts,js}'); }); diff --git a/gulp/fonts.js b/gulp/fonts.js index 4ea3bc05..1324bb7a 100644 --- a/gulp/fonts.js +++ b/gulp/fonts.js @@ -1,6 +1,6 @@ gulp.task('fonts', function () { app.copy( config.bowerDir + '/font-awesome/fonts/*', - config.fonts.output + config.fonts.outputDir ); }); diff --git a/gulp/scripts.js b/gulp/scripts.js index 503b39ac..b141bafc 100644 --- a/gulp/scripts.js +++ b/gulp/scripts.js @@ -1,10 +1,7 @@ gulp.task('scripts', function () { - app.js( - [ - config.bowerDir + '/jquery/dist/jquery.js', - config.bowerDir + '/bootstrap-sass/assets/javascripts/bootstrap.js', - config.js.search - ], - 'site.js' - ); + app.js([ + config.bowerDir + '/jquery/dist/jquery.js', + config.bowerDir + '/bootstrap-sass/assets/javascripts/bootstrap.js', + config.js.pattern + ], 'site.js'); }); diff --git a/gulp/styles.js b/gulp/styles.js index 47bb86ac..e51e5454 100644 --- a/gulp/styles.js +++ b/gulp/styles.js @@ -1,6 +1,6 @@ gulp.task('styles', function () { - app.css([ + app.sass([ config.bowerDir + '/font-awesome/css/font-awesome.css', - config.sass.source + '/site.sass' + config.sass.sourceDir + '/site.sass' ], 'site.css'); }); diff --git a/gulp/watch.js b/gulp/watch.js index 00ac5f9c..232e7448 100644 --- a/gulp/watch.js +++ b/gulp/watch.js @@ -1,7 +1,8 @@ gulp.task('watch', function () { plugins.refresh.listen(); - gulp.watch(config.sass.source + config.sass.search, ['styles']); - gulp.watch(config.sass.source + config.scss.search, ['styles']); - gulp.watch(config.js.source + config.js.search, ['scripts']); + gulp.watch(config.sass.sourceDir + config.sass.pattern, ['styles']); + gulp.watch(config.sass.sourceDir + config.scss.pattern, ['styles']); + + gulp.watch(config.js.sourceDir + config.js.pattern, ['scripts']); }); diff --git a/gulpfile.js b/gulpfile.js index 77ed7051..a6dc5261 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -9,30 +9,30 @@ global.config = { }, bowerDir: 'vendor/bower', fonts: { - output: 'source/assets/fonts' + outputDir: 'source/assets/fonts' }, htmlmin: { collapseWhitespace: true }, js: { - source: 'assets/js', - search: '/js/**/*.js', - output: 'source/assets/js' + sourceDir: 'assets/js', + pattern: '/js/**/*.js', + outputDir: 'source/assets/js' }, production: plugins.util.env.production || false, sass: { - source: 'assets/sass', - search: '/**/*.sass', - output: 'source/assets/css' + sourceDir: 'assets/sass', + pattern: '/**/*.sass', + outputDir: 'source/assets/css' }, scss: { - search: '/**/*.scss' + pattern: '/**/*.scss' } } global.app = {}; -app.css = function (paths, filename) { +app.sass = function (paths, filename) { gulp.src(paths) .pipe(plugins.plumber()) .pipe(plugins.if(!config.production, plugins.sourcemaps.init())) @@ -43,7 +43,7 @@ app.css = function (paths, filename) { .pipe(plugins.if(config.production, plugins.cleanCss())) .pipe(plugins.if(!config.production, plugins.sourcemaps.write('.'))) .pipe(plugins.if(!config.production, plugins.refresh())) - .pipe(gulp.dest(config.sass.output)); + .pipe(gulp.dest(config.sass.outputDir)); }; app.js = function (paths, filename) { @@ -53,7 +53,7 @@ app.js = function (paths, filename) { .pipe(plugins.concat(filename)) .pipe(plugins.if(config.production, plugins.uglify())) .pipe(plugins.if(!config.production, plugins.sourcemaps.write('.'))) - .pipe(gulp.dest(config.js.output)); + .pipe(gulp.dest(config.js.outputDir)); }; app.copy = function (source, destination) {