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 browser could not
find the js files when viewing the page.

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 42d2ffc commit a1eec4d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tasks/gulp/compile-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ const postcsspseudoclasses = require('postcss-pseudo-classes')({
// check if destination flag is dist
const isDist = taskArguments.destination === 'dist' || false

// Set the destination
const destinationPath = function () {
// Public & Dist directories do no need namespaced with `govuk`
if (taskArguments.destination === 'dist' || 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 +152,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 +175,5 @@ gulp.task('js:compile', () => {
})
))
.pipe(eol())
.pipe(gulp.dest(destination))
.pipe(gulp.dest(destinationPath))
})

0 comments on commit a1eec4d

Please sign in to comment.