GOV.UK Publishing Components

This gem:

  • Provides shared components for applications
  • Provides helpers to generate component payloads
  • Provides an application to preview components

Components should be added to this gem if they are required in more than one application, otherwise they should be added to that application.

Screenshot of component guide

How to

Architecture / structure

Source

There are 2 types of helper classes in this app:

  • AppHelpers. Are exposed to the applications using this gem. They should be documented using RDoc.
  • Component Presenters. Anything in these classes is only for use within the components. They should be marked @private.

GOV.UK Frontend

This gem is the way GOV.UK consumes GOV.UK Frontend, part of the GOV.UK Design System.

We use NPM to pull in the GOV.UK Frontend styles and Javascript, but we don't commit the node_modules directory. To install GOV.UK Frontend on your machine, run:

npm install

You'll need to have installed Node and NPM for this.

Documentation

See the rubydoc.info documentation

Run the documentation locally with:

bundle exec yard server --reload

Running tests

The default rake task runs all tests:

bin/rake

Javascript is tested using Jasmine and the Jasmine gem. Tests can be run either in the browser or on the command line via the dummy app’s tasks:

# browser
bin/rake app:jasmine

# command line
bin/rake app:jasmine:ci

Licence

MIT Licence