Overview
GOV.UK Notify Admin uses Rollup to bundle JavaScript (both ES5 and ESM), compile SCSS, and manage static assets like images, fonts, and error pages.Asset directories
- Source:
app/assets/- Original JavaScript, SCSS, images, and error pages - Output:
app/static/- Compiled, bundled assets served to browsers - Dependencies:
node_modules/- Third-party packages including GOV.UK Frontend
Build process
Development workflow
- ESM compilation - Modern JavaScript modules
- SCSS compilation - Stylesheets with sourcemaps
- ES5 compilation - Legacy JavaScript bundle
Rollup configuration
The build is defined inrollup.config.mjs:
ESM bundle
Compiles modern JavaScript with tree-shaking and minification:- Error pages from
app/assets/error_pages/ - Custom images from
app/assets/images/ - GOV.UK Frontend images (rebrand-aware)
- GOV.UK Frontend fonts
- Manifest file for PWA support
SCSS compilation
Compiles SCSS to minified CSS with sourcemaps:/static/ URLs to / for CDN compatibility.
ES5 bundle
Bundles legacy JavaScript with jQuery and other dependencies:GOV.UK Frontend rebrand support
The build supports both classic and rebranded GOV.UK Frontend assets:Deployment
Local development
When running locally, Flask serves static assets athttp://localhost:6012/static/:
Production deployment
Static files are uploaded to S3 and served via CloudFront CDN:- max-age=315360000 - 10 years (effectively permanent)
- immutable - Prevents revalidation requests
Asset URL helpers
Templates use theasset_url() helper which switches between local and CDN URLs:
Testing
Dependencies
Build tools
- rollup (4.44.1) - Module bundler
- @rollup/plugin-node-resolve - Resolve node_modules imports
- @rollup/plugin-terser - JavaScript minification
- rollup-plugin-styler - SCSS compilation
- sass (1.89.2) - SCSS compiler
- postcss-replace - URL rewriting for production
Runtime dependencies
- govuk-frontend (5.11.1) - Design system components
- jquery (3.5.0) - DOM manipulation
- morphdom (2.6.1) - Efficient DOM diffing
- timeago (1.6.5) - Relative timestamps
- textarea-caret (3.1.0) - Caret position detection
- cbor-js (0.1.0) - WebAuthn credential encoding