Skip to content

Commit

Permalink
Adjust Sass task to run PostCSS first before renaming
Browse files Browse the repository at this point in the history
Ensures that PostCSS can match against the source stylesheet path
  • Loading branch information
colinrotherham committed Jan 19, 2023
1 parent 6fd00c4 commit e37f173
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions tasks/gulp/compile-assets.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,25 @@ export function compileStylesheets () {
gulp.src(`${slash(paths.src)}/govuk/all.scss`, {
sourcemaps: true
})
.pipe(rename({
basename: 'govuk-frontend',
suffix: `-${pkg.version}`
}))
),
)
.pipe(rename({
basename: 'govuk-frontend'
})),

compileStylesheet(
gulp.src(`${slash(paths.src)}/govuk/all-ie8.scss`, {
sourcemaps: true
})
.pipe(rename({
basename: 'govuk-frontend-ie8',
suffix: `-${pkg.version}`
}))
)
.pipe(rename({
basename: 'govuk-frontend-ie8'
}))
)
.pipe(rename({
suffix: `-${pkg.version}`,
extname: '.min.css'
}))

.pipe(gulp.dest(slash(destPath), {
sourcemaps: '.'
}))
Expand All @@ -75,12 +78,16 @@ export function compileStylesheets () {
gulp.src(`${slash(paths.fullPageExamples)}/**/styles.scss`, {
sourcemaps: true
})
.pipe(rename((path) => {
path.basename = path.dirname
path.dirname = 'full-page-examples'
}))
)
.pipe(rename((path) => {
path.basename = path.dirname
path.dirname = 'full-page-examples'
}))
)
.pipe(rename({
extname: '.min.css'
}))

.pipe(gulp.dest(slash(destPath), {
sourcemaps: '.'
}))
Expand All @@ -99,9 +106,6 @@ function compileStylesheet (stream, options = {}) {
return stream
.pipe(plumber(errorHandler(stream, 'compile:scss')))
.pipe(sass(options))
.pipe(rename({
extname: '.min.css'
}))
.pipe(postcss())
.pipe(plumber.stop())
}
Expand Down

0 comments on commit e37f173

Please sign in to comment.