-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5901cc4
commit 6d75bfb
Showing
3 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Look and Feel | ||
|
||
GOV.UK look and feel as a single easy import (at least that's the goal). | ||
|
||
## Usage | ||
|
||
To use look-and-feel first add it to your `package.json`: | ||
|
||
> yarn add @hmcts/look-and-feel | ||
|
||
Then configure it in your `app.js`: | ||
|
||
const express = require('express'); | ||
const app = express(); | ||
... | ||
const lookAndFeel = require('@hmcts/look-and-feel'); | ||
lookAndFeel.configure(app); | ||
... | ||
|
||
## Documentation | ||
|
||
All documentation is stored in the [docs] folder. | ||
|
||
## Development | ||
|
||
We use the [Dockerfile] and [docker-compose.yml] to create a development | ||
container used for running tests, etc. | ||
|
||
To start the container run: | ||
|
||
``` | ||
make | ||
``` | ||
|
||
Once complete you will be dropped in to a shell where you can run `yarn`. | ||
|
||
[Dockerfile]:https://github.com/hmcts/nodejs-one-per-page/blob/master/Dockerfile | ||
[docker-compose.yml]:https://github.com/hmcts/nodejs-one-per-page/blob/master/docker-compose.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Documentation | ||
|
||
## Configuration | ||
|
||
- [Configuring views][views] | ||
|
||
[views]:https://github.com/hmcts/look-and-feel/blob/master/docs/configuration/configuring-views | ||
This comment has been minimized.
Sorry, something went wrong. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Configuring Views | ||
|
||
Look-and-feel will by default configure express so that it can load the GOV.UK | ||
templates and partials. | ||
|
||
In order to configure express so it has access to your apps views you have two | ||
options: [Standard express views setting] or [Explicitly set views settings]. | ||
|
||
## Standard express views setting | ||
|
||
Configure your views folders in the standard express way: | ||
|
||
``` | ||
const app = express(); | ||
app.set('views', [path.resolve(__dirname, 'views')]); | ||
lookAndFeel.configure(app); | ||
``` | ||
|
||
Be sure to set the views before you configure look-and-feel. If you set the | ||
views after configuring look-and-feel you'll only overwrite the settings that | ||
look-and-feel has set. | ||
|
||
## Explicitly set views settings | ||
|
||
When configuring look-and-feel you can pass in the views folders you want | ||
express to look for your templates in: | ||
|
||
``` | ||
const app = express(); | ||
lookAndFeel.configure(app, { | ||
express: { | ||
views: [path.resolve(__dirname, 'views')] | ||
} | ||
}); | ||
``` | ||
|
||
[Standard express views setting]: #standard-express-views-setting | ||
[Explicitly set views settings]: #explicitly-set-views-settings |
Hi @michaeldfallen, looks like this link is broken...nice work!