Skip to main content

Install using precompiled files

You can install GOV.UK Frontend by copying our CSS, JavaScript and asset files into your project. If you install this way, you can try GOV.UK Frontend in your application without having to make many changes.

Warning In your live application, you should install with Node.js package manager (npm) instead.

What you cannot do after installing

You’ll not be able to:

  • change Sass settings, for example override colours or set your own font
  • use the Nunjucks code from the Design System website to add components
  • import an individual component’s CSS or JavaScript
  • use GOV.UK Frontend’s colours or mixins in your custom code

Copy the files

  1. Download the release-<VERSION-NUMBER>.zip file at the bottom of the latest GOV.UK Frontend release note.
  2. Unzip the zip file.
  3. Copy the assets folder to the root of your project’s public folder, so that for example <YOUR-SITE-URL>/assets/govuk-logotype-crown.png shows the govuk-logotype-crown.png image in your users’ browsers.
  4. Copy the 2 .css files to a stylesheets folder in the root of your project’s public folder, so that for example <YOUR-SITE-URL>/stylesheets/govuk-frontend-<VERSION-NUMBER>.min.css shows the CSS file in your users’ browsers.
  5. Copy the .js file to a JavaScript folder in the root of your project’s public folder, so that for example <YOUR-SITE-URL>/javascript/govuk-frontend-<VERSION-NUMBER>.min.js shows the JavaScript file in your users’ browsers.

Check an example page

  1. Create a page in your project using the following HTML (in your live application, you should use the Design System page template instead):

    <!DOCTYPE html>
    <html lang="en" class="govuk-template ">
        <title>Example - GOV.UK</title>
        <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
        <!--[if !IE 8]><!-->
          <link rel="stylesheet" href="/stylesheets/govuk-frontend-<VERSION-NUMBER>.min.css">
        <!--[if IE 8]>
          <link rel="stylesheet" href="/stylesheets/govuk-frontend-ie8-<VERSION-NUMBER>.min.css">
      <body class="govuk-template__body ">
          document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');
        <!-- component HTML -->
        <script src="/javascript/govuk-frontend-<VERSION-NUMBER>.min.js"></script>
  2. Replace <VERSION-NUMBER> so the 3 filenames match the files you copied from GOV.UK Frontend’s GitHub repo.

  3. Go to the example accordion component on the Design System website and copy the HTML from the first example.

  4. Replace <!-- component HTML --> with the accordion HTML you copied.

  5. Run your application - you can check it works the same way as the Design System accordion example by selecting the buttons and checking the accordion ‘shows’ and ‘hides’ sections.

You can now get the full code for page layouts and other components from the Design System website.

If the accordion does not work, you can find out more about how to import GOV.UK Frontend’s CSS and JavaScript.