Install with Node.js package manager (npm)
Requirements
-
GOV.UK Frontend requires Node.js version 12.17.0 or later to support ECMAScript (ES) modules. Where possible, we recommend you install the latest Long Term Support (LTS) version.
cd
to the root of your project and check if you have apackage.json
file. If you do not have the file, create it by running:npm init
Install Dart Sass - version 1.0.0 or higher.
If you’re using Dart Sass 1.33.0 or greater, you may see deprecation warnings when compiling your Sass. You can silence deprecation warnings caused by dependencies if required.
Do not use either LibSass or Ruby Sass, which are deprecated, for new projects.
Although GOV.UK Frontend currently supports LibSass (version 3.3.0 and above) and Ruby Sass (version 3.4.0 and above), we will remove support in future. If you’re using either of these Sass compilers, you should migrate to Dart Sass as soon as you reasonably can.
You can also install Nunjucks v3.0.0 or later if you want to use GOV.UK Frontend’s Nunjucks macros.
Install GOV.UK Frontend
Run:
npm install govuk-frontend --save
When the installation finishes, the govuk-frontend
package will be in your node_modules
folder.
You should now get started by getting the CSS, assets and JavaScript working with one GOV.UK Frontend component.