Permalink
Browse files

Run `pub-delete` earlier, and if bailing on functions, run callback

  • Loading branch information...
crgeary committed Jun 4, 2018
1 parent 526e0a4 commit 820b6cc6bcd988af5d47e8eac5a79aa3ed533dbd
Showing with 4 additions and 3 deletions.
  1. +4 −3 gulpfile.babel.js
View
@@ -45,22 +45,23 @@ gulp.task('init-watch', () => {
})
gulp.task('build', () => {
runSequence(['sass', 'js', 'fonts', 'images', 'pub-delete', 'build-functions'], 'hugo')
runSequence('pub-delete', ['sass', 'js', 'fonts', 'images', 'build-functions'], 'hugo')
})
gulp.task('build-preview', () => {
runSequence(['sass', 'js', 'fonts', 'images', 'pub-delete', 'build-functions'], 'hugo-preview')
runSequence('pub-delete', ['sass', 'js', 'fonts', 'images', 'build-functions'], 'hugo-preview')
})
gulp.task('build-functions', (cb) => {
fs.readdir('./src/lambda', (err, files) => {
if (err) {
throw err;
cb(err);
}
if (!files.filter(file => file.endsWith('.js')).length) {
console.log('No Netlify functions.');
cb();
return;
}
return spawn('netlify-lambda', ['build', 'src/lambda'], { stdio: 'inherit' }).on('close', (code) => {

0 comments on commit 820b6cc

Please sign in to comment.