Skip to content

Commit

Permalink
Upgrade to Gulp v4
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrotherham committed Apr 17, 2019
1 parent e61a3a3 commit 000e509
Show file tree
Hide file tree
Showing 7 changed files with 783 additions and 434 deletions.
97 changes: 40 additions & 57 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
const paths = require('./config/paths.json')
const gulp = require('gulp')
const taskListing = require('gulp-task-listing')
const runsequence = require('run-sequence')
const taskArguments = require('./tasks/gulp/task-arguments')
const nodemon = require('nodemon')

// Gulp sub-tasks
require('./tasks/gulp/clean.js')
require('./tasks/gulp/lint.js')
require('./tasks/gulp/compile-assets.js')
require('./tasks/gulp/nodemon.js')
require('./tasks/gulp/watch.js')
// new tasks
require('./tasks/gulp/copy-to-destination.js')
Expand All @@ -20,16 +19,17 @@ require('./tasks/gulp/sassdoc.js')
// Umbrella scripts tasks for preview ---
// Runs js lint and compilation
// --------------------------------------
gulp.task('scripts', cb => {
runsequence('js:compile', cb)
})
gulp.task('scripts', gulp.series(
'js:compile'
))

// Umbrella styles tasks for preview ----
// Runs js lint and compilation
// --------------------------------------
gulp.task('styles', cb => {
runsequence('scss:lint', 'scss:compile', cb)
})
gulp.task('styles', gulp.series(
'scss:lint',
'scss:compile'
))

// Copy assets task ----------------------
// Copies assets to taskArguments.destination (public)
Expand All @@ -42,70 +42,53 @@ gulp.task('copy:assets', () => {
// All test combined --------------------
// Runs js, scss and accessibility tests
// --------------------------------------
gulp.task('test', cb => {
runsequence(
'scss:lint',
'scss:compile',
cb
)
})
gulp.task('test', gulp.series(
'scss:lint',
'scss:compile'
))

// Copy assets task for local & heroku --
// Copies files to
// taskArguments.destination (public)
// --------------------------------------
gulp.task('copy-assets', cb => {
runsequence(
'styles',
'scripts',
cb
)
})

// Dev task -----------------------------
// Runs a sequence of task on start
// --------------------------------------
gulp.task('dev', cb => {
runsequence(
'clean',
'copy-assets',
'sassdoc',
'serve',
cb
)
})
gulp.task('copy-assets', gulp.series(
'styles',
'scripts'
))

// Serve task ---------------------------
// Restarts node app when there is changed
// affecting js, css or njk files
// --------------------------------------
gulp.task('serve', gulp.parallel(
'watch',
'nodemon'
))

gulp.task('serve', ['watch'], () => {
return nodemon({
script: 'app/start.js'
})
})
// Dev task -----------------------------
// Runs a sequence of task on start
// --------------------------------------
gulp.task('dev', gulp.series(
'clean',
'copy-assets',
'sassdoc',
'serve'
))

// Build package task -----------------
// Prepare package folder for publishing
// -------------------------------------
gulp.task('build:package', cb => {
runsequence(
'clean',
'copy-files',
'js:compile',
cb
)
})
gulp.task('build:dist', cb => {
runsequence(
'clean',
'copy-assets',
'copy:assets',
'update-assets-version',
cb
)
})
gulp.task('build:package', gulp.series(
'clean',
'copy-files',
'js:compile'
))
gulp.task('build:dist', gulp.series(
'clean',
'copy-assets',
'copy:assets',
'update-assets-version'
))

// Default task -------------------------
// Lists out available tasks.
Expand Down
Loading

0 comments on commit 000e509

Please sign in to comment.