Skip to content

Commit 6dd01dc

Browse files
Add font files script
1 parent 504df1d commit 6dd01dc

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ docs/reports/*/*.html
44
!docs/reports/*/index.html
55
node_modules
66
urls.txt
7+
static

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ To serve the Lighthouse Report Summary dashboard on your local machine,
88
use the command `yarn && yarn serve` and visit `http://127.0.0.1:8080`
99
(hit `ctrl` + `c` when you're ready to stop the server).
1010

11+
This installs the dependencies. If you received an error
12+
`Module not found: Error: Can't resolve …` in regard to the font files,
13+
follow the next step to install the fonts.
14+
15+
### Install font files
16+
17+
To install self-hosted fonts locally, place the font files
18+
in `./static/fonts/`. This can be done with the command `yarn fonts`.
19+
20+
### Run Lighthouse audit
21+
1122
To run a Lighthouse audit, use the command `yarn lighthouse`. This command
1223
looks for a file named `urls.txt`, containing a list of relative URL paths
1324
to test. If this file does not exist, only the root of the domain is tested.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"clean": "rm -rf ./docs/static",
66
"compile-dev": "webpack --mode=development",
77
"compile-prod": "webpack --mode=production",
8+
"fonts": "./scripts/fonts.sh",
89
"process-reports": "node scripts/process-reports.js",
910
"lighthouse": "lhci collect && lhci collect --additive --mobile && lhci upload",
1011
"lint": "eslint --max-warnings=0 lighthouserc.js scripts src webpack.config.js",

scripts/fonts.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
# Add required webfonts locally to src/static/fonts/ directory.
4+
mkdir ./static/
5+
mkdir ./static/fonts
6+
cd ./static/fonts
7+
curl 'https://github.com/cfpb/consumerfinance.gov/blob/main/static.in/cfgov-fonts/fonts/2cd55546-ec00-4af9-aeca-4a3cd186da53.woff2?raw=true' --output '1e9892c0-6927-4412-9874-1b82801ba47a.woff'
8+
curl 'https://github.com/cfpb/consumerfinance.gov/blob/main/static.in/cfgov-fonts/fonts/2cd55546-ec00-4af9-aeca-4a3cd186da53.woff2?raw=true' --output '2cd55546-ec00-4af9-aeca-4a3cd186da53.woff2'
9+
curl 'https://github.com/cfpb/consumerfinance.gov/blob/main/static.in/cfgov-fonts/fonts/627fbb5a-3bae-4cd9-b617-2f923e29d55e.woff2?raw=true' --output '627fbb5a-3bae-4cd9-b617-2f923e29d55e.woff2'
10+
curl 'https://github.com/cfpb/consumerfinance.gov/blob/main/static.in/cfgov-fonts/fonts/627fbb5a-3bae-4cd9-b617-2f923e29d55e.woff2?raw=true' --output 'f26faddb-86cc-4477-a253-1e1287684336.woff'
11+
cd ../../

0 commit comments

Comments
 (0)