Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
to = "/configure-components/"
status = 301

[[redirects]]
from = "/import-css/"
to = "/include-css/"
status = 301

# Asset filenames with fingerprint hashes (which at the minute is only the font
# from GOV.UK Frontend) are given an 'infinite' max-age and treated as
# immutable.
Expand Down
7 changes: 3 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"scripts": {
"start": "bundle exec middleman server",
"postinstall": "npm run build:sassdoc && npm run build:sassdocv5 && npm run build:sassdocv4",
"build:sassdoc": "sassdoc --no-update-notifier --parse node_modules/govuk-frontend/dist/govuk/ > data/sassdoc.json",
"build:sassdocv5": "sassdoc --no-update-notifier --parse node_modules/govuk-frontend-v5/dist/govuk/ > data/sassdoc-v5.json",
"build:sassdocv4": "sassdoc --no-update-notifier --parse node_modules/govuk-frontend-v4/govuk/ > data/sassdoc-v4.json",
"build:sassdoc": "sassdoc -c sassdoc.config.json --parse node_modules/govuk-frontend/dist/govuk/ > data/sassdoc.json",
"build:sassdocv5": "sassdoc -c sassdoc.config.json --parse node_modules/govuk-frontend-v5/dist/govuk/ > data/sassdoc-v5.json",
"build:sassdocv4": "sassdoc -c sassdoc.config.json --parse node_modules/govuk-frontend-v4/govuk/ > data/sassdoc-v4.json",
"lint": "standard",
"check-links": "hyperlink --canonicalroot https://frontend.design-system.service.gov.uk --internal --recursive build/index.html --skip 'property=\"og:image\"' --skip 'application.js' | tee check-links.log | tap-mocha-reporter min"
},
"devDependencies": {
"govuk-frontend": "^6.1.0",
"govuk-frontend": "github:alphagov/govuk-frontend#cf77c484e",
"govuk-frontend-v4": "npm:govuk-frontend@^4.10.1",
"govuk-frontend-v5": "npm:govuk-frontend@^5.14.0",
"hyperlink": "^5.0.4",
Expand Down
4 changes: 4 additions & 0 deletions sassdoc.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"exclude": ["**/*.import.scss"],
"no-update-notifier": true
}
152 changes: 0 additions & 152 deletions source/import-css/index.html.md.erb

This file was deleted.

31 changes: 17 additions & 14 deletions source/import-font-and-images-assets/index.html.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ To use the font and image assets from GOV.UK Frontend, you can either:
- copy the font and image files into your application

## Serve the assets from the GOV.UK Frontend assets folder - recommended
- serve the assets from the GOV.UK Frontend assets folder (recommended)
- copy the font and image files into your application

## Serve the assets from the GOV.UK Frontend assets folder

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

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

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

## Copy the font and image files into your application

If you decide to copy the assets instead, copy the:
If you decide to copy the assets instead, copy these 3 items:

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

### If you have your own folder structure

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.

Set one of the following before the `@import` line in your Sass file:

- `$govuk-assets-path`
- `$govuk-images-path` and `$govuk-fonts-path`
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.

Set the `$govuk-assets-path` variable if your `font` and `image` folders have the same parent folder. For example:
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:

```scss
$govuk-assets-path: "/<YOUR-ASSETS-FOLDER>/";
@use "node_modules/govuk-frontend/dist/govuk" as * with (
$govuk-assets-path: "/<YOUR-ASSETS-FOLDER>/"
);
```

Set the `$govuk-images-path` and `$govuk-fonts-path` variables if your `font` and `image` folders have different parent folders. For example:
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:

```scss
$govuk-images-path: "/<YOUR-IMAGES-FOLDER>/";
$govuk-fonts-path: "/<YOUR-FONTS-FOLDER>/";
@use "node_modules/govuk-frontend/dist/govuk" as * with (
$govuk-images-path: "/<YOUR-IMAGES-FOLDER>/",
$govuk-fonts-path: "/<YOUR-FONTS-FOLDER>/"
);
```

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.
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.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ prevent_indexing: true

This content has moved. You can now find out how to import CSS, assets and javascript as 3 separate pages in the following locations:

- [Import CSS](../import-css/)
- [Import CSS](../include-css/)
- [Import font and images assets](../import-font-and-images-assets/)
- [Import JavaScript](../import-javascript/)
Loading