Skip to content

Commit 1d45259

Browse files
lfdebrux36degrees
andcommitted
Make GOV.UK Frontend assets paths work with http prefix
Co-authored-by: Oliver Byford <oliver.byford@digital.cabinet-office.gov.uk>
1 parent d791c7b commit 1d45259

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

lib/assets/stylesheets/_govuk_tech_docs.scss

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
$govuk-assets-path: "/assets/govuk/assets/" !default;
1+
// Set $govuk-assets-path so that $govuk-images-path and $govuk-fonts-path
2+
// (used below, but set in govuk/base) are correct.
3+
$govuk-assets-path: "/assets/govuk/assets/";
4+
5+
// Use Sprockets' asset url helpers to add the http prefix if present.
6+
// GOV.UK Frontend provides hooks for us to define the url lookup functions,
7+
// see https://frontend.design-system.service.gov.uk/sass-api-reference/
8+
@function tech-docs-image-url-function($filename) {
9+
@return image-url($govuk-images-path + $filename);
10+
}
11+
12+
@function tech-docs-font-url-function($filename) {
13+
@return font-url($govuk-fonts-path + $filename);
14+
}
15+
16+
$govuk-font-url-function: "tech-docs-font-url-function";
17+
$govuk-image-url-function: "tech-docs-image-url-function";
218

319
// Include only the bits of GOV.UK Frontend we need
420
$govuk-new-link-styles: true;

0 commit comments

Comments
 (0)