-
Notifications
You must be signed in to change notification settings - Fork 237
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
Get scripts and assets from config #2319
base: main
Are you sure you want to change the base?
Conversation
4d31fab
to
d8276fb
Compare
5895226
to
03bd181
Compare
@@ -74,6 +74,11 @@ module.exports = function setupNodeEvents (on, config) { | |||
config.env.packageFolder = path.join(config.env.projectFolder, 'node_modules', 'govuk-prototype-kit') | |||
} | |||
|
|||
if ('govuk-frontend' in dependencies) { | |||
const frontEndConfigFile = path.join(config.env.projectFolder, 'node_modules', 'govuk-frontend', 'govuk-prototype-kit.config.json') | |||
config.env.frontendAssetsFolder = fse.readJsonSync(frontEndConfigFile).assets.find(asset => !asset.split(path.sep).pop().includes('.')) |
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.
This closely targets the current implementation inside govuk-frontend
- if they add another assets
item to their config which doesn't have any dots then this may identify the wrong one.
<script src="/manage-prototype/dependencies/govuk-frontend/govuk/all.js"></script> | ||
<script src="/manage-prototype/dependencies/govuk-frontend/govuk-prototype-kit/init.js"></script> | ||
<script src="/plugin-assets/govuk-prototype-kit/lib/assets/javascripts/kit.js"></script> | ||
{% for scriptConfig in managePlugins.scripts %} |
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.
This seems to be a duplicate of govuk-prototype-kit/includes/scripts.njk
, and both are taking their input from the plugin config. We should reuse the existing include rather than copying it. This can be done by calling the field in the model pluginConfig
rather than managePlugins
.
eb696aa
to
532b418
Compare
532b418
to
9c11033
Compare
Remove hard coded references for the locations of the govuk-frontend scripts and assets.