mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-04 16:11:11 -04:00
Move GOVUK Frontend templates from node_modules
`node_modules` isn't available in a live environment so the `.njk` templates we're now using from GOVUK Frontend need to go in the repo' code. Adds them in a new `app/templates/vendor` folder to match how we do that in `app/assets/stylesheets`.
This commit is contained in:
39
gulpfile.js
39
gulpfile.js
@@ -49,6 +49,42 @@ const copy = {
|
||||
fonts: () => {
|
||||
return src(paths.govuk_frontend + 'assets/fonts/**/*')
|
||||
.pipe(dest(paths.dist + 'fonts/'));
|
||||
},
|
||||
templates: (cb) => {
|
||||
// Put names of GOVUK Frontend templates here
|
||||
const _templates = [
|
||||
'template',
|
||||
'skip-link',
|
||||
'header',
|
||||
'footer'
|
||||
];
|
||||
let done = 0;
|
||||
|
||||
// Copy the templates for each component across, preserving their folder structure
|
||||
_templates.forEach(name => {
|
||||
let _src = [
|
||||
paths.govuk_frontend + 'components/' + name + '/macro.njk',
|
||||
paths.govuk_frontend + 'components/' + name + '/template.njk'
|
||||
];
|
||||
let _dest = paths.templates + 'vendor/govuk-frontend/components/' + name;
|
||||
|
||||
// template.njk isn't a component
|
||||
if (name === 'template') {
|
||||
_src = paths.govuk_frontend + 'template.njk';
|
||||
_dest = paths.templates + 'vendor/govuk-frontend';
|
||||
}
|
||||
|
||||
src(_src)
|
||||
.pipe(
|
||||
dest(_dest)
|
||||
.on('end', () => { // resolve promise if all copied
|
||||
done = done + 1;
|
||||
if (done === _templates.length) {
|
||||
cb();
|
||||
}
|
||||
})
|
||||
)
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -207,8 +243,9 @@ const lint = {
|
||||
|
||||
// Default: compile everything
|
||||
const defaultTask = parallel(
|
||||
series(
|
||||
parallel(
|
||||
copy.govuk_frontend.fonts,
|
||||
copy.govuk_frontend.templates,
|
||||
images
|
||||
),
|
||||
series(
|
||||
|
||||
Reference in New Issue
Block a user