govuk_publishing_components 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -47
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 482dfbc7d06559bff8317484a04b836a0f7245e2
|
4
|
+
data.tar.gz: f0ea67a5f4e111ee694a8a57139790fa060ebdc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1c8c48a5c86712bef8a7150dc6445393dc196a01d42f848ec32b6bb6695e066f6d98f1bf8bc272b9b42a1533ba2c748115dd442878fed7f53edc83a155711ce
|
7
|
+
data.tar.gz: e24e979e709e2cf07582e2029e35ca7a95cd5a543b13870609524e7661ecac60348a2bf602bba51d92e70e8621dafcd04633485c645e9494820585f522d9a000
|
data/README.md
CHANGED
@@ -2,7 +2,32 @@
|
|
2
2
|
|
3
3
|
A gem to document components in GOV.UK frontend applications.
|
4
4
|
|
5
|
-
|
5
|
+
![Screenshot of component guide](docs/screenshot.png)
|
6
|
+
|
7
|
+
## Write components in your application
|
8
|
+
|
9
|
+
Components are packages of template, style, behaviour and documentation that live in your application.
|
10
|
+
|
11
|
+
A component must:
|
12
|
+
* [meet the component principles](docs/component_principles.md)
|
13
|
+
* [follow component conventions](docs/component_conventions.md)
|
14
|
+
|
15
|
+
A lead paragraph component would be included in a template like this:
|
16
|
+
|
17
|
+
```erb
|
18
|
+
<%= render 'components/lead-paragraph', text: "A description is one or two leading sentences" %>
|
19
|
+
```
|
20
|
+
|
21
|
+
## Set up a component guide
|
22
|
+
|
23
|
+
This gem creates a component guide for all your application’s components.
|
24
|
+
|
25
|
+
An example guide this gem created for government-frontend:
|
26
|
+
https://government-frontend.herokuapp.com/component-guide
|
27
|
+
|
28
|
+
The guide includes your application’s `application.scss` and `application.js` files by default. This is [configurable](#configuration).
|
29
|
+
|
30
|
+
### Install gem
|
6
31
|
|
7
32
|
Add this line to your application's Gemfile in the [development and test groups](http://bundler.io/v1.12/groups.html#grouping-your-dependencies):
|
8
33
|
|
@@ -29,53 +54,9 @@ end
|
|
29
54
|
If your application was government-frontend the component guide would be at:
|
30
55
|
http://government-frontend.dev.gov.uk/component-guide
|
31
56
|
|
32
|
-
###
|
33
|
-
|
34
|
-
Components are partials included by your application:
|
35
|
-
```erb
|
36
|
-
<%= render 'components/description', { description: "A description is one or two leading sentences." } %>
|
37
|
-
```
|
38
|
-
|
39
|
-
`govuk_publishing_components` expects the following component structure:
|
40
|
-
|
41
|
-
* a partial view in `app/views/components` - The template logic and markup, also defines the arguments expected. Filename must begin with an underscore.
|
42
|
-
* a documentation file in `app/views/components/docs` - a `.yml` per component, describing the component and containing fixture data.
|
43
|
-
* a SCSS module in `app/assets/stylesheets/components` - The styling of the component
|
44
|
-
* [a Javascript module](https://github.com/alphagov/govuk_frontend_toolkit/blob/master/docs/javascript.md#modules) in `app/assets/javascripts/components` - JS behaviour of the component
|
45
|
-
* a unit test in `test/components` - testing the component renders correctly based on parameters passed in
|
46
|
-
|
47
|
-
For a "print link" component you would have:
|
48
|
-
* app/views/components/_print-link.html.erb
|
49
|
-
* app/views/components/docs/print-link.yml
|
50
|
-
* app/assets/stylesheets/components/_print-link.scss
|
51
|
-
* test/components/print_link_test.rb
|
52
|
-
|
53
|
-
The component guide will include your application’s styles and scripts. It will include `application.scss` and `application.js` by default but this is [configurable](#configuration).
|
54
|
-
|
55
|
-
### Write documentation
|
56
|
-
|
57
|
-
The `.yml` file must have:
|
58
|
-
* a name
|
59
|
-
* a description
|
60
|
-
* a default fixture (this can be `{}` if the component takes no parameters)
|
61
|
-
|
62
|
-
#### Example documentation
|
63
|
-
|
64
|
-
```yaml
|
65
|
-
name: Name of component
|
66
|
-
description: Short description of component
|
67
|
-
body: |
|
68
|
-
Optional markdown providing further detail about the component
|
69
|
-
acceptance_criteria: |
|
70
|
-
Markdown listing what this component must do to be accessible
|
71
|
-
fixtures:
|
72
|
-
default:
|
73
|
-
some_parameter: 'The parameter value'
|
74
|
-
```
|
75
|
-
|
76
|
-
### Configuration
|
57
|
+
### Configure the gem
|
77
58
|
|
78
|
-
|
59
|
+
Use a config block in an initializer:
|
79
60
|
|
80
61
|
```ruby
|
81
62
|
# config/initializers/govuk_publishing_components.rb
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_publishing_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -34,16 +34,16 @@ dependencies:
|
|
34
34
|
name: slimmer
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
39
|
+
version: '0'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - "
|
44
|
+
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: '0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: sass-rails
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|