You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to having distributed assets that are combined with `go-bindata`, we require the `get-renderer-version` and `fetch-renderer-version` tasks to ensure the version of `dp-renderer` as specified in `go.mod` is used.
52
+
Due to having distributed assets that are combined with `go-bindata`, we require the `fetch-renderer` task to ensure the version of `dis-design-system-go` is as specified in `go.mod` is used.
57
53
58
-
The existing `build` and `debug` tasks should then be updated to use the relevant `generate-` command as a prerequisite:
54
+
The `build` and `debug` tasks should use the relevant `generate-` command as a prerequisite:
59
55
60
56
```Makefile
61
57
.PHONY: build
@@ -67,8 +63,6 @@ debug: generate-debug
67
63
68
64
## Config
69
65
70
-
:warning: The `RendererVersion` is unlikely to have been set previously :warning:
71
-
72
66
`config.go`shouldbeupdatedtoincludefourproperties: `PatternLibraryAssetsPath`, `SiteDomain`, `Debug` and `RendererVersion`.
73
67
74
68
You will also need to add additional logic to `config.go` to handle the path for pattern library assets when running `make debug` or the published assets in a `prod` build.
@@ -128,7 +122,7 @@ func get() (*Config, error) {
128
122
129
123
You will need the `RenderClient` interface in order to implement the methods that `dis-design-system-go` exposes.
// send the mapped data, with ResponseWriter and template name defined by the actual template file name (e.g. cookies-preferences.tmpl) to the render lib
We use a HTTP middleware handler to intercept error status in our controllers then call `BuildErrorPage` to render an error page. To set up the middleware we use [Alice](https://github.com/justinas/alice) when instantiating the router in our controllers. See [README](/README.md#instantiation) for setting up the render client that we pass to the middleware.
172
+
We use a HTTP middleware handler to intercept error status in our controllers then call `BuildErrorPage` to render an error page. To set up the middleware we use [Alice](https://github.com/justinas/alice) when instantiating the router in our controllers.
1. Test your changes by running `make debug` from the consuming app. Follow the steps in the [README](README.md#generate-the-css-and-js) to generate the css/js locally.
Copy file name to clipboardExpand all lines: README.md
+11-34Lines changed: 11 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,8 @@ Beta rendering library for Dissemination frontend go microservices. `dis-design-
6
6
7
7
* Run `make help` to see full list of make targets
8
8
9
+
## CSS/JS
10
+
9
11
### Install dependencies
10
12
11
13
To build, run, deploy, test and audit the app you will need some additional tooling:
@@ -50,11 +52,11 @@ No further dependencies other than those defined in `go.mod`
50
52
51
53
* Once built, you can find assets stored on the web server, default location is [localhost:9002/dist/assets/](http://localhost:9002/dist/assets/)
52
54
53
-
###Go library
55
+
## Go library
54
56
55
57
`dis-design-system-go` also acts as a Go library which contains template helpers, model structs and components that can be used by the consuming frontend app to serve HTML consistently across the ONS website. To make use of the `go` rendering, you will need to install it within your `go` frontend app.
56
58
57
-
####Installation
59
+
### Installation
58
60
59
61
Other than `dis-design-system-go` itself, you will need a utility that can combine service-specific and `dis-design-system-go` assets. We currently use `go-bindata` for this process. From the consuming frontend app, run the following commands to install:
60
62
@@ -64,49 +66,24 @@ Other than `dis-design-system-go` itself, you will need a utility that can combi
64
66
65
67
*`go-bindata`: `go get github.com/kevinburke/go-bindata`
66
68
67
-
#### Instantiation
68
-
69
-
Assuming you have `go-bindata` set up to generate the relevant asset helper functions, you can instantiate the renderer with a default client (in this case, the default client is [`unrolled`](https://github.com/unrolled/render)).
You can also instantiate a `Render` struct without a default client by using `New()`. This requires a rendering client that fulfills the `Renderer` interface to be passed in as well.
When mapping data to a page model, you can use `NewBasePageModel` to instantiate a base page model with its `PatternLibraryAssetsPath` and `SiteDomain` properties auto-populated via the `Render` struct:
If an error occurs during page build, either because of an incorrect template name or incorrect data mapping, `dp-renderer` will write an error via an `errorResponse` struct.
73
+
See the [go example](GO_EXAMPLE.md) guide for an example implementation.
97
74
98
75
## Using design patterns or components in your service
99
76
100
77
See [PATTERNS](PATTERNS.md) for details.
101
78
102
-
## Worked example
103
-
104
-
See the [go example](GO_EXAMPLE.md) guide for a worked example. This guide can also be used to support migrating from `dp-renderer` and `dp-design-system` to `dis-design-system-go`.
105
-
106
79
## Contributing
107
80
108
81
See [CONTRIBUTING](CONTRIBUTING.md) for details.
109
82
83
+
## Migrating
84
+
85
+
See [MIGRATION](MIGRATION.md) for details on how to migrate from `dp-design-system` and `dp-renderer` to the `dis-design-system-go`.
0 commit comments