Code Monkey home page Code Monkey logo

govuk_frontend_toolkit's Introduction

GOV.UK frontend toolkit


You can help us improve the GOV.UK frontend toolkit by completing our 5 minute survey.


A collection of Sass and JavaScript files for using as part of your application's frontend.

This project is not tied to a specific language and is designed to be used as a dependency in as many different languages as needed.

There's a Gemfile and a package.json in this directory, but they are only for running tests and are not an indication that this project prefers Ruby or Node.js.

Installing

Ruby on Rails

We recommend you use the govuk_frontend_toolkit_gem and follow the installation instructions.

Node.js

govuk_frontend_toolkit_npm is an NPM package that can be installed or included in your package.json.

If you are using a build tool that depends on Libsass then you may need to upgrade to a more recent version to use the grid helpers. Minimal compatible versions include node-sass 1.0.0, grunt-sass 0.16.0, gulp-sass 1.2.0 and libsass 3.0.0.

Composer

govuk_frontend_toolkit_composer is an composer package that can be added to your composer.json

Other projects

Using the tagged versions

Each version of the toolkit is tagged with the version number in this format:

v*version number*, for example v4.1.1 for version 4.1.1.

If your dependency management tool allows the use of Git repositories as dependencies, you can point to a version by using its tag.

For example, if you are using bower, you can add the toolkit to your bower.json like so:

"govuk_frontend_toolkit": "git://github.com/alphagov/govuk_frontend_toolkit#v4.1.1" (assuming you want version 4.1.1)

Using git submodules

You can include the toolkit as a [git submodule][https://git-scm.com/book/en/v2/Git-Tools-Submodules].

To add the submodule to your project run the following command substituting the path to a subdirectory in your project's assets directory:

$ git submodule add https://github.com/alphagov/govuk_frontend_toolkit.git ./path/to/assets/govuk_frontend_toolkit

We recommend you use https rather than ssh for submodules as they don't require key exchanges when deploying to remote servers.

If you clone a project with the toolkit submodule installed you will need to initialise the submodule with the following command:

$ git submodule init

To update the toolkit to the latest version you can use:

$ git submodule update

Running tests

Tests for this project use Jasmine for the JavaScript and Ruby's scss and scss-lint to check the stylesheets.

The requirements are Node.js 0.8 or higher and PhantomJS, and Ruby:

bundle install
npm install
npm test

Standard JavaScript

govuk_frontend_toolkit uses standardjs, an opinionated JavaScript linter. All JavaScript files follow its conventions. Read more

Using the local test runner

The test suite can be run by opening the ./spec/support/LocalTestRunner.html file in a browser for a more detailed trace of errors.

The files for unit tests and any supporting JavaScript should be added to ./spec/manifest.js file.

Usage

At the top of a Sass file in your project you should use an @import rule to include the file for the mixins you require, eg if you want the conditionals and typography mixins you should add:

@import '_conditionals';
@import '_typography';

You may need to include the relative path to the toolkit if it is installed as a submodule:

@import '../toolkit/_conditionals';

If you are compiling Sass from the command-line tool, here are some options we recommend.

In development:

sass --style expanded --line-numbers --load-path [path to]/govuk_frontend_toolkit/stylesheets input.scss output.css

In production:

sass --style compressed --load-path [path to]/govuk_frontend_toolkit/stylesheets input.scss output.css

Documentation

Licence

Released under the MIT Licence, a copy of which can be found in the file LICENCE.

govuk_frontend_toolkit's People

Contributors

edds avatar tombye avatar fofr avatar gemmaleigh avatar bradwright avatar dsingleton avatar alexmuller avatar nickcolley avatar benilovj avatar alextea avatar jabley avatar robinwhittleton avatar timpaul avatar colinrotherham avatar bfirsh avatar jonnywyatt avatar futurefabric avatar binaryberry avatar boffbowsh avatar alext avatar quis avatar erkde avatar ikennaokpala avatar jamiecobbett avatar h-lame avatar cjcheshire avatar tommyp avatar tijmenb avatar markhurrell avatar remdd avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.