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

Add govuk frontend loading with scss and npm #98

Merged
merged 7 commits into from
Mar 13, 2024

Conversation

252afh
Copy link
Contributor

@252afh 252afh commented Mar 11, 2024

Context

Adding govuk frontend loading in the style Duncan implemented

Changes proposed in this pull request

Guidance to review

Check the app loads and the govuk styling is in place

Relevant links

Things to check

  • I have added any new ENV vars in all deployed environments
  • I have tested any code added or changed

django_app/package.json Outdated Show resolved Hide resolved
@lmwilkigov
Copy link
Collaborator

@duncanjbrown, any thoughts on the compression error in the build here?

@duncanjbrown
Copy link

This is down to a nuance of docker-compose: when you mount a local volume in the docker-compose.yml its contents will shadow whatever was built in the build step.

The fix is to make sure this isn't touched is to mount a persistent volume on the node_modules folder

    volumes:
      - ./:/app/:z
      - /app/django_app/frontend/node_modules

then correct the path in style.scss, which needs to be relative to /app as the container runs in the context .:

@import "django_app/frontend/node_modules/govuk-frontend/dist/govuk/all";

and you need to correct the Dockerfile to this so that the node_modules folder is copied and not its contents:

COPY --from=node_modules /app/node_modules /app/django_app/frontend/node_modules

You can confirm it's built correctly with

docker-compose run -it django-app bash -c "ls django_app/frontend/node_modules" 

and you should see govuk-frontend

Further reading: https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder

@lmwilkigov lmwilkigov merged commit 29b118c into main Mar 13, 2024
3 checks passed
@252afh 252afh deleted the feature/add-govuk-frontend branch March 14, 2024 09:40
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

Successfully merging this pull request may close these issues.

None yet

4 participants