From 1d45259eb0d440e1a1ffa88558796b78453286f3 Mon Sep 17 00:00:00 2001 From: Laurence de Bruxelles Date: Wed, 17 Aug 2022 12:37:38 +0100 Subject: [PATCH] Make GOV.UK Frontend assets paths work with http prefix Co-authored-by: Oliver Byford --- lib/assets/stylesheets/_govuk_tech_docs.scss | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/assets/stylesheets/_govuk_tech_docs.scss b/lib/assets/stylesheets/_govuk_tech_docs.scss index 3080ec35..2b444236 100644 --- a/lib/assets/stylesheets/_govuk_tech_docs.scss +++ b/lib/assets/stylesheets/_govuk_tech_docs.scss @@ -1,4 +1,20 @@ -$govuk-assets-path: "/assets/govuk/assets/" !default; +// Set $govuk-assets-path so that $govuk-images-path and $govuk-fonts-path +// (used below, but set in govuk/base) are correct. +$govuk-assets-path: "/assets/govuk/assets/"; + +// Use Sprockets' asset url helpers to add the http prefix if present. +// GOV.UK Frontend provides hooks for us to define the url lookup functions, +// see https://frontend.design-system.service.gov.uk/sass-api-reference/ +@function tech-docs-image-url-function($filename) { + @return image-url($govuk-images-path + $filename); +} + +@function tech-docs-font-url-function($filename) { + @return font-url($govuk-fonts-path + $filename); +} + +$govuk-font-url-function: "tech-docs-font-url-function"; +$govuk-image-url-function: "tech-docs-image-url-function"; // Include only the bits of GOV.UK Frontend we need $govuk-new-link-styles: true;