Skip to content
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

Support assets compilation at build time #2341

Open
smeny opened this issue Sep 19, 2023 · 2 comments
Open

Support assets compilation at build time #2341

smeny opened this issue Sep 19, 2023 · 2 comments

Comments

@smeny
Copy link

smeny commented Sep 19, 2023

Context

We have a prototype hosted with AWS ECS and we followed the instructions to publish it in “production” mode (https://prototype-kit.service.gov.uk/docs/publishing). We are trying to keep resources to a minimum but we noticed that assets are compiled each time the container starts which delays the startup getting our container CPU to 100%.

We think compilation is done here but we couldn't find a way to call this function directly from our prototype.

We suggest implementing a call such as "npm run compile-assets" to be able to compile assets when a docker image is built.

Alternatives

Compile assets at runtime

Additional information (if applicable)

I would say this feature fits into several objectives of reducing processing time such as carbon-neutral initiatives or point 12 of the technology code of practice, aiming to make technology sustainable.

Thank you!

@frankieroberto
Copy link
Contributor

This sounds like it’d be something worth investigating to me! 👍

The Heroku documentation for Node.js apps suggests that it will run npm run build automatically before compiling the slug.

If the CSS and javascript assets were compiled by a build step, the source assets themselves could perhaps get added to the .slugignore file, so that the overall slug size is reduced a bit (which can help speed up deploys). That said, most of the CSS and javascript source code is within the govuk-frontend npm package, and that'd still be needed at runtime for all of the macros, so it might not be a huge saving?

@smeny
Copy link
Author

smeny commented Sep 19, 2023

The govuk-frontend package has several build scripts that could be invoked.
I have been trying to invoke them via npx but without success so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants