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. This is so, for example, <YOUR-SITE-URL>/assets/images/govuk-crest.png shows the govuk-crest.png image in your users’ browsers.
  4. Copy the .css and .css.map files to a stylesheets folder in the root of your project’s public folder. This is so, for example, <YOUR-SITE-URL>/stylesheets/govuk-frontend-<VERSION-NUMBER>.min.css shows the CSS file in your users’ browsers.
  5. Copy the .js and .js.map files to a JavaScripts folder in the root of your project’s public folder. This is so, for example, <YOUR-SITE-URL>/javascripts/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">
      <head>
        <title>Example - GOV.UK</title>
        <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
        <link rel="manifest" href="/assets/manifest.json">
        <link rel="stylesheet" href="/stylesheets/govuk-frontend-<VERSION-NUMBER>.min.css">
      </head>
      <body class="govuk-template__body">
        <script>document.body.className += ' js-enabled' + ('noModule' in HTMLScriptElement.prototype ? ' govuk-frontend-supported' : '');</script>
        <!-- component HTML -->
        <script type="module" src="/javascripts/govuk-frontend-<VERSION-NUMBER>.min.js"></script>
        <script type="module">
          import { initAll } from '/javascripts/govuk-frontend-<VERSION-NUMBER>.min.js'
          initAll()
        </script>
      </body>
    </html>
    
  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 and check for errors in the browser console - it should work 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.