Skip to content

Instantly share code, notes, and snippets.

@MatMoore
Created April 4, 2018 10:14
Show Gist options
  • Save MatMoore/d2eda41c8687c15487c1260d6eb61712 to your computer and use it in GitHub Desktop.
Save MatMoore/d2eda41c8687c15487c1260d6eb61712 to your computer and use it in GitHub Desktop.
Making changes to GOV.UK frontend locally

1. Run a rendering app

  1. Checkout https://github.com/alphagov/government-frontend, install ruby, bundle etc
  2. Run ./startup.sh --live to point to the live content store
  3. Run PLEK_SERVICE_STATIC_URI=static.dev.gov.uk (or wherever static is running) to point to a local instance of static
  4. This will take a minute to render a page(?)

Shared templates are loaded from static via slimmer, which magically merges templates together using nokogiri.

Slimmer may cache templates (?) although I don't think it's supposed to in development mode

2. Run static

  1. https://github.com/alphagov/static
  2. Static will use the published version of govuk_template by default. Override it by changing gem 'govuk_template', '0.23.0' to gem 'govuk_template', :path => '../govuk_template' in your Gemfile

3. Change govuk_template

Some (but not all?) static templates extend the govuk_template which is shared across government. It will eventually be replaced by the new design system.

  1. https://github.com/alphagov/govuk_template
  2. The source files aren't used directly, so you need to run the build task after every change bundle exec rake
  3. The template is cross compiled into a million different template languages, so you may need to change build_tools/compiler/*_processer.rb files to keep things in sync
  4. don't forget to keep running bundle exec rake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment