-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Watch for changes to assets #3910
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { join } from 'path' | ||
|
||
import { files, task } from 'govuk-frontend-tasks' | ||
import gulp from 'gulp' | ||
|
||
/** | ||
* Copy GOV.UK Frontend assets (for watch) | ||
* | ||
* @type {import('govuk-frontend-tasks').TaskFunction} | ||
*/ | ||
export const assets = (options) => gulp.series( | ||
task.name('copy:assets', () => | ||
files.copy('**/*', { | ||
srcPath: join(options.srcPath, 'govuk/assets'), | ||
destPath: join(options.destPath, 'govuk/assets') | ||
}) | ||
) | ||
) |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,7 +4,7 @@ import { npm, task } from 'govuk-frontend-tasks' | |||||
import gulp from 'gulp' | ||||||
import slash from 'slash' | ||||||
|
||||||
import { fixtures, scripts, styles, templates } from './index.mjs' | ||||||
import { assets, fixtures, scripts, styles, templates } from './index.mjs' | ||||||
|
||||||
/** | ||||||
* Watch task | ||||||
|
@@ -57,5 +57,12 @@ export const watch = (options) => gulp.parallel( | |||||
gulp.watch([ | ||||||
`${slash(options.srcPath)}/govuk/**/*.{md,njk}` | ||||||
], templates(options)) | ||||||
), | ||||||
|
||||||
// Copy GOV.UK Frontend static assets | ||||||
task.name('copy:assets watch', () => | ||||||
gulp.watch([ | ||||||
`${slash(options.srcPath)}/govuk/assets/**` | ||||||
], assets(options)) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not for this PR, but we might want to remove
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had noticed that when deleting a file from Removing the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah good point, it would only stop early triggering of tasks really—but might free up some "polling" CPU time for all our Windows users too? Would be a separate issue to synchronise directories fully |
||||||
) | ||||||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we share this new task with
release.mjs
too?It's mostly identical between
package.mjs
andrelease.mjs
Would just need
destPath
overriding without thegovuk/
prefixThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will leave this as a future improvement if that's alright.