diff --git a/tasks/gulp/compile-assets.js b/tasks/gulp/compile-assets.js index a401088d97..645507de5b 100644 --- a/tasks/gulp/compile-assets.js +++ b/tasks/gulp/compile-assets.js @@ -28,6 +28,17 @@ const postcsspseudoclasses = require('postcss-pseudo-classes')({ // check if destination flag is dist const isDist = taskArguments.destination === 'dist' || false +// Set the destination +const destinationPath = function () { + if (taskArguments.destination === 'dist') { + return taskArguments.destination + } else if (taskArguments.destination === 'public') { + return taskArguments.destination + } else { + return `${taskArguments.destination}/govuk/` + } +} + const errorHandler = function (error) { // Log the error to the console console.error(error.message) @@ -142,7 +153,6 @@ gulp.task('scss:compile', () => { gulp.task('js:compile', () => { // for dist/ folder we only want compiled 'all.js' file let srcFiles = isDist ? configPaths.src + 'all.js' : configPaths.src + '**/*.js' - let destination = isDist ? taskArguments.destination : taskArguments.destination + '/govuk/' return gulp.src([ srcFiles, @@ -166,5 +176,5 @@ gulp.task('js:compile', () => { }) )) .pipe(eol()) - .pipe(gulp.dest(destination)) + .pipe(gulp.dest(destinationPath)) })