Skip to content

Commit

Permalink
fix(scss): amend sass loadpaths to include node_modules directory
Browse files Browse the repository at this point in the history
This allows us to remove the node modules prefix from the govuk scss
import in all.scss. Which would resolve loading issues for users.

BREAKING CHANGE: This PR changes the loadpath for govuk frontend.  You
will now need to ensure your project SASS configuration includes
node_modules within its loadpaths in order to compile, however this is
often default behaviour in many build tools.

fix #927
  • Loading branch information
chrispymm committed Nov 15, 2024
1 parent 7e83b3f commit 4b32d59
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion gulp/dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ gulp.task("dist:javascript", () => {
gulp.task("dist:css", () => {
return gulp
.src("gulp/dist-scss/*.scss")
.pipe(sass())
.pipe(sass({
includePaths: ["node_modules"]
}))
.pipe(postcss([autoprefixer, cssnano]))
.pipe(
rename((path) => ({
Expand Down
4 changes: 3 additions & 1 deletion gulp/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ gulp.task(
"docs:styles", () => {
return gulp
.src("docs/assets/stylesheets/application.scss")
.pipe(sass())
.pipe(sass({
includePaths: ["node_modules"]
}))
.pipe(rename({
suffix: `-${VERSION}`
}))
Expand Down
2 changes: 1 addition & 1 deletion src/moj/all.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "node_modules/govuk-frontend/dist/govuk/base";
@import "govuk-frontend/dist/govuk/base";

@import "settings/all";
@import "helpers/all";
Expand Down

0 comments on commit 4b32d59

Please sign in to comment.