How to start using the Design System in your project
We recommend using npm to install the Design System and compiling the CSS from the source. This is because:
- npm makes it easier for you to stay up to date with any additions or bug fixes
- there are some easy component customisation options available to you if you compile the CSS yourself
What you need to do
We recommend using the latest Long Term Support (LTS) version, or a minimum of version 8.10.0.
If your project does not already have a
package.jsonfile, create one by running this command from your project’s root folder:
Install a SASS compiler. We recommend installing Dart Sass into your project.
npm install sass --save-dev
Dart Sass will give warnings when compiling CSS because of a breaking change to how Sass will handle division in the future. You can avoid these warnings by using an older version of Dart Sass.
npm install email@example.com --save-dev
Install the Design System with this command:
npm install @scottish-government/pattern-library --save-dev
You’ll now have a copy of the Design System’s source code in your project’s
Using the Design System
SASS and CSS
A typical starting point for your main SCSS file might look something like this.
You’ll always need to include the base styles in your file. They contain the typography and colour rules used by the components, and a number of helpful SASS mixins and functions used by them.
You can choose which components you want to include. You do not need to include them all if you do not want to. For example:
Feedback, help or support
If you need any help or want to give any feedback you can e-mail us at: firstname.lastname@example.org