Skip to content

Commit

Permalink
Fixes public directory structure
Browse files Browse the repository at this point in the history
Some of the changes made before meant that js files were being compiled
and placed in a `govuk` directory. This meant that the app could not
find the js files eg. `govuk/all.js`

Current & desired folder structure for `public` when serving up the review app:

public
├── components
│   ├── accordion
│   ├── button
│   ├── character-count
│   ├── checkboxes
│   ├── details
│   ├── error-summary
│   ├── header
│   ├── radios
│   └── tabs
├── vendor
│   └── polyfills
├── all.js
├── app-ie8.css
├── app-legacy-ie8.css
├── app-legacy.css
├── app.css
└── common.js
  • Loading branch information
aliuk2012 committed Jun 19, 2019
1 parent fc8d1c9 commit 58458ff
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tasks/gulp/compile-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand All @@ -166,5 +176,5 @@ gulp.task('js:compile', () => {
})
))
.pipe(eol())
.pipe(gulp.dest(destination))
.pipe(gulp.dest(destinationPath))
})

0 comments on commit 58458ff

Please sign in to comment.