diff --git a/README.md b/README.md new file mode 100644 index 0000000..ca9dd8c --- /dev/null +++ b/README.md @@ -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 diff --git a/docs/README.markdown b/docs/README.markdown new file mode 100644 index 0000000..95a9d7e --- /dev/null +++ b/docs/README.markdown @@ -0,0 +1,7 @@ +# Documentation + +## Configuration + +- [Configuring views][views] + +[views]:https://github.com/hmcts/look-and-feel/blob/master/docs/configuration/configuring-views diff --git a/docs/configuration/configuring-views.markdown b/docs/configuration/configuring-views.markdown new file mode 100644 index 0000000..57721ec --- /dev/null +++ b/docs/configuration/configuring-views.markdown @@ -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