-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(gulp): improve dev workflow pipeline with gulp
- Loading branch information
Showing
5 changed files
with
757 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
const gulp = require("gulp"); | ||
const sass = require("gulp-sass")(require("sass")); | ||
const {createGulpEsbuild} = require("gulp-esbuild") | ||
const esbuild = createGulpEsbuild({ | ||
incremental: true, // enables the esbuild"s incremental build | ||
piping: true, // enables piping | ||
}) | ||
|
||
// Copy all the govuk-frontend assets across | ||
gulp.task( | ||
"docs:copy-dependencies", () => { | ||
return gulp.src([ | ||
"node_modules/govuk-frontend/dist/govuk/assets/**/*", | ||
"src/moj/assets/**/*" | ||
]) | ||
.pipe(gulp.dest("public/assets")) | ||
} | ||
); | ||
|
||
// Copy package vendor files across | ||
gulp.task( | ||
"docs:copy-vendor", () => { | ||
return gulp.src([ | ||
"src/moj/vendor/**/*.js" | ||
]) | ||
.pipe(gulp.dest("public/assets/javascript")) | ||
} | ||
); | ||
|
||
// Ordering is important here! - Docs > Package > GovUK frontend | ||
gulp.task( | ||
"docs:copy-files", gulp.series( | ||
"docs:copy-dependencies", | ||
"docs:copy-vendor", | ||
) | ||
); | ||
|
||
// Compile the docs site stylesheet | ||
gulp.task( | ||
"docs:styles", () => { | ||
return gulp | ||
.src("docs/assets/stylesheets/application.scss") | ||
.pipe(sass()) | ||
.pipe(gulp.dest("public/assets/stylesheets")); | ||
} | ||
); | ||
|
||
// Bundle the docs site javascript | ||
gulp.task( | ||
"docs:scripts", () => { | ||
return gulp | ||
.src("docs/assets/javascript/all.js") | ||
.pipe(esbuild({ | ||
outfile: "all.js", | ||
target: "es6", | ||
bundle: true, | ||
})) | ||
.pipe(gulp.dest("public/assets/javascript")) | ||
} | ||
); | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.