Skip to content

Commit

Permalink
refactor(react-components): change font files to woff2 format
Browse files Browse the repository at this point in the history
This patch changes the font files from otf to woff2 format to optimize
font file size.
  • Loading branch information
taylrj committed Aug 5, 2022
1 parent a1c7b99 commit 077bc67
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/react-components/src/text/utils/webfonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const _ = {
}

const baseGCSDir = 'https://www.twreporter.org/assets/font/'
const fileExt = '.woff2'

const gcsFontFolder = {
[fonts.notoSansTC]: 'NotoSansTC',
Expand All @@ -26,7 +27,7 @@ const getFontFaces = ({ font, folder }) => {
font-family: "${font}";
font-weight: ${fontWeight[fontWeightKey]};
font-display: swap;
src: url("${baseGCSDir}${folder}/${fontWeightKey}.otf");
src: url("${baseGCSDir}${folder}/${fontWeightKey}${fileExt}");
}
`
return _.reduce(
Expand All @@ -45,7 +46,6 @@ const fontFaces = {
}),
}

const fileExt = '.otf'
let fontGCSFiles = []

_.forEach(fontFaces, function(fontFace, font) {
Expand Down

0 comments on commit 077bc67

Please sign in to comment.