Skip to content

Commit f2111b0

Browse files
committed
Update fonts page
1 parent 59c0848 commit f2111b0

1 file changed

Lines changed: 13 additions & 14 deletions

File tree

source/import-font-and-images-assets/index.html.md.erb

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ To use the font and image assets from GOV.UK Frontend, you can either:
1414

1515
Set up your routing so requests for files in `<YOUR-SITE-URL>/assets` are served from `/node_modules/govuk-frontend/dist/govuk/assets`.
1616

17-
For example if you're using [express.js](https://expressjs.com/), add the following to your `app.js` file:
17+
For example if you use the web framework [Express.js](https://expressjs.com/), add the following to your `app.js` file:
1818

1919
```javascript
2020
const path = require('path');
@@ -23,7 +23,7 @@ app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-fron
2323

2424
## Copy the font and image files into your application
2525

26-
If you decide to copy the assets instead, copy the:
26+
If you decide to copy the assets instead, copy these 3 items:
2727

2828
- `/node_modules/govuk-frontend/dist/govuk/assets/images` folder to `<YOUR-APP>/assets/images`
2929
- `/node_modules/govuk-frontend/dist/govuk/assets/fonts` folder to `<YOUR-APP>/assets/fonts`
@@ -33,24 +33,23 @@ You should use an automated task or your build pipeline to copy the files, so yo
3333

3434
### If you have your own folder structure
3535

36-
If you use a different folder structure than `<YOUR-APP>/assets/images` and `<YOUR-APP>/assets/fonts`, you can set Sass variables so that Sass builds the CSS to point to your folders.
36+
If you use a different folder structure than `<YOUR-APP>/assets/images` and `<YOUR-APP>/assets/fonts`, you can [configure GOV.UK Frontend](/include-css/#configure-gov-uk-frontend) so that Sass builds the CSS according to your folder structure.
3737

38-
Set one of the following before the `@import` line in your Sass file:
39-
40-
- `$govuk-assets-path`
41-
- `$govuk-images-path` and `$govuk-fonts-path`
42-
43-
Set the `$govuk-assets-path` variable if your `font` and `image` folders have the same parent folder. For example:
38+
Configure the [`$govuk-assets-path`](/sass-api-reference/#govuk-assets-path) variable if your `font` and `image` folders have the same parent folder. For example:
4439

4540
```scss
46-
$govuk-assets-path: "/<YOUR-ASSETS-FOLDER>/";
41+
@use "node_modules/govuk-frontend/dist/govuk" as * with (
42+
$govuk-assets-path: "/<YOUR-ASSETS-FOLDER>/"
43+
);
4744
```
4845

49-
Set the `$govuk-images-path` and `$govuk-fonts-path` variables if your `font` and `image` folders have different parent folders. For example:
46+
Configure the [`$govuk-images-path`](/sass-api-reference/#govuk-images-path) and [`$govuk-fonts-path`](/sass-api-reference/#govuk-fonts-path) variables if your `font` and `image` folders have different parent folders. For example:
5047

5148
```scss
52-
$govuk-images-path: "/<YOUR-IMAGES-FOLDER>/";
53-
$govuk-fonts-path: "/<YOUR-FONTS-FOLDER>/";
49+
@use "node_modules/govuk-frontend/dist/govuk" as * with (
50+
$govuk-images-path: "/<YOUR-IMAGES-FOLDER>/",
51+
$govuk-fonts-path: "/<YOUR-FONTS-FOLDER>/"
52+
);
5453
```
5554

56-
You can also use your own function to generate paths, for example if you're using `asset-pipeline` in [sass-rails](https://github.com/rails/sass-rails). Set the `$govuk-image-url-function` and `$govuk-font-url-function` variables to the name of your function.
55+
You can also use your own function to generate paths, for example if youre using `asset-pipeline` in [sass-rails](https://github.com/rails/sass-rails). Configure the [`$govuk-image-url-function`](/sass-api-reference/#govuk-image-url-function) and [$govuk-font-url-function](/sass-api-reference/#govuk-font-url-function) variables with the function you need to use.

0 commit comments

Comments
 (0)