Overview
GOV.UK Notify Admin uses SCSS (Sass) compiled via Rollup, extending GOV.UK Frontend with custom components and utilities.Architecture
File structure
main.scss entry point
Configuration
Compilation settings
Fromrollup.config.mjs:
- Extracts to separate CSS file (not CSS-in-JS)
- Includes
node_modulesfor importing packages - Minifies output
- Generates sourcemaps
- Silences Sass deprecation warnings
GOV.UK Frontend configuration
Key settings:Global styles
_globals.scss
Asset URL helpers
Component patterns
Progressive enhancement
Components hidden until JavaScript is available:Component structure
Example:components/checkboxes.scss
- BEM naming:
.selection-summary__icon,.selection-summary__text--folders - GOV.UK Frontend mixins:
@include govuk-font() - GOV.UK Frontend functions:
govuk-spacing() - Progressive enhancement with
$govuk-frontend-supported-css-class
Using GOV.UK Frontend utilities
Typography
Spacing
Colours
Responsive design
mobile (320px), tablet (641px), desktop (769px)
Component examples
Big number component
Copy to clipboard
Loading indicator
View-specific styles
Styles scoped to specific sections of the app:views/dashboard.scss
Styles for the dashboard page:views/template.scss
Styles for template editing:.visible-as-matches-search-query is added by JavaScript (see live-search.mjs).
Print styles
Separate print stylesheet inprint.scss:
Linting
Running the linter
Configuration
Stylelint config inpackage.json:
Best practices
1. Use GOV.UK Frontend first
Before writing custom styles, check if GOV.UK Frontend provides:- A component (Button, Radios, etc.)
- A utility (spacing, typography, colours)
- A pattern (form validation, page templates)
2. Follow BEM naming
3. Progressive enhancement
Hide JavaScript-dependent features:4. Use spacing and typography mixins
5. Minimize nesting
Migration from GOV.UK Elements
The codebase is transitioning from GOV.UK Elements to GOV.UK Frontend:Related documentation
- Static asset management - Build process and compilation
- Templates and Jinja - How styles connect to markup
- JavaScript architecture - JavaScript that manipulates styles
- GOV.UK Frontend documentation