From cb9527c86f569b45dd44d6d8f9c1292e300c65c8 Mon Sep 17 00:00:00 2001 From: Oliver Peate Date: Tue, 29 Sep 2020 16:23:07 +0100 Subject: [PATCH 1/2] Allow GOV UK assets path to be overriden If the variable has already been set, then don't override it. This allows implementors to adjust for other settings (such as Middleman's http_prefix setting). --- lib/assets/stylesheets/_govuk_tech_docs.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/assets/stylesheets/_govuk_tech_docs.scss b/lib/assets/stylesheets/_govuk_tech_docs.scss index 61b76a3a..3080ec35 100644 --- a/lib/assets/stylesheets/_govuk_tech_docs.scss +++ b/lib/assets/stylesheets/_govuk_tech_docs.scss @@ -1,4 +1,4 @@ -$govuk-assets-path: "/assets/govuk/assets/"; +$govuk-assets-path: "/assets/govuk/assets/" !default; // Include only the bits of GOV.UK Frontend we need $govuk-new-link-styles: true; From 29efd4aff05190267c28a88513bfd698776dec41 Mon Sep 17 00:00:00 2001 From: Oliver Peate Date: Tue, 29 Sep 2020 16:39:50 +0100 Subject: [PATCH 2/2] Use helpers for asset URLs Using Sprockets helpers for asset URLs provides support for Middleman's http_prefix feature, which is useful for sites hosted on Github pages. --- lib/assets/stylesheets/modules/_anchored-heading.scss | 4 ++-- lib/assets/stylesheets/modules/_search.scss | 4 ++-- lib/assets/stylesheets/modules/_toc.scss | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/assets/stylesheets/modules/_anchored-heading.scss b/lib/assets/stylesheets/modules/_anchored-heading.scss index eda7834c..962cb395 100644 --- a/lib/assets/stylesheets/modules/_anchored-heading.scss +++ b/lib/assets/stylesheets/modules/_anchored-heading.scss @@ -18,12 +18,12 @@ text-decoration: none; text-indent: -9999em; - background-image: url('/images/anchored-heading-icon.png'); + background-image: image-url('/images/anchored-heading-icon.png'); background-repeat: no-repeat; background-position: center center; @include govuk-device-pixel-ratio { - background-image: url('/images/anchored-heading-icon-2x.png'); + background-image: image-url('/images/anchored-heading-icon-2x.png'); background-size: $icon-width $icon-height; } diff --git a/lib/assets/stylesheets/modules/_search.scss b/lib/assets/stylesheets/modules/_search.scss index e13bda18..9bde54cd 100644 --- a/lib/assets/stylesheets/modules/_search.scss +++ b/lib/assets/stylesheets/modules/_search.scss @@ -36,7 +36,7 @@ $input-size: 40px; padding: 0; width: $input-size; height: 100%; - background-image: url('/images/search-button.png'); + background-image: image-url('/images/search-button.png'); background-repeat: no-repeat; background-position: 2px 50%; text-indent: -5000px; @@ -104,7 +104,7 @@ $input-size: 40px; left: -9px; width: 10px; height: 20px; - background: no-repeat url('/images/search-result-caret.svg') center right; + background: no-repeat image-url('/images/search-result-caret.svg') center right; background-size: contain; } } diff --git a/lib/assets/stylesheets/modules/_toc.scss b/lib/assets/stylesheets/modules/_toc.scss index ff2e7085..921c5abf 100644 --- a/lib/assets/stylesheets/modules/_toc.scss +++ b/lib/assets/stylesheets/modules/_toc.scss @@ -152,12 +152,12 @@ height: 20px; float: right; - background-image: url('/images/govuk-icn-numbered-list.png'); + background-image: image-url('/images/govuk-icn-numbered-list.png'); background-repeat: no-repeat; background-position: left center; @include govuk-device-pixel-ratio { - background-image: url('/images/govuk-icn-numbered-list@2x.png'); + background-image: image-url('/images/govuk-icn-numbered-list@2x.png'); background-size: 20px 20px; } } @@ -178,12 +178,12 @@ height: 20px; cursor: pointer; - background-image: url('/images/govuk-icn-close.png'); + background-image: image-url('/images/govuk-icn-close.png'); background-repeat: no-repeat; background-position: left center; @include govuk-device-pixel-ratio { - background-image: url('/images/govuk-icn-close@2x.png'); + background-image: image-url('/images/govuk-icn-close@2x.png'); background-size: 20px 20px; }