Skip to content

Commit

Permalink
chore: remove old fonts type like woff and add cache on icon font (#2153
Browse files Browse the repository at this point in the history
)
  • Loading branch information
theo-mesnil authored Jul 31, 2023
1 parent f8b17a7 commit a8624d3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@ jobs:
- run:
name: prepare font hash
command: |
echo "export ICON_FONT_HASH=$(sha1sum packages/IconFont/fonts/welcome-icon-font.woff | awk '{ print $1 }')" >> $BASH_ENV
echo "export ICON_FONT_HASH=$(sha1sum packages/IconFont/fonts/welcome-icon-font.woff2 | awk '{ print $1 }')" >> $BASH_ENV
source $BASH_ENV
yarn build:core
- aws-s3/sync:
from: packages/IconFont/fonts
to: s3://welcome-ui/public/fonts/icon-font/$ICON_FONT_HASH/
to: s3://welcome-ui/public/fonts/icon-font/$ICON_FONT_HASH --cache-control 'public, max-age=31536000' --exclude '*' --include 'welcome-icon-font.woff2'
arguments: |
--metadata GitCommit=$CIRCLE_SHA1 --delete
- aws-s3/sync:
from: packages/IconFont/fonts
to: s3://wttj-production/fonts/icon-font/$ICON_FONT_HASH/
to: s3://wttj-production/fonts/icon-font/$ICON_FONT_HASH --cache-control 'public, max-age=31536000' --exclude '*' --include 'welcome-icon-font.woff2'
arguments: |
--metadata GitCommit=$CIRCLE_SHA1 --delete
Expand Down
2 changes: 1 addition & 1 deletion scripts/core.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

FONTS_DIR=packages/IconFont/fonts
FONT_FILE="$FONTS_DIR/welcome-icon-font.woff"
FONT_FILE="$FONTS_DIR/welcome-icon-font.woff2"

if [[ -f "$FONT_FILE" ]]; then
ICON_FONT_HASH=$(sha1sum $FONT_FILE | awk '{ print $1 }')
Expand Down
4 changes: 1 addition & 3 deletions scripts/webfont-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ const writeIconFont = files => {
dest: `${ICON_FONT_PATH}/fonts`,
fontName: FONT_NAME,
codepoints: newUnicodeMap,
types: ['woff', 'woff2', 'ttf', 'svg'],
// Pass timestamp so that hash doesn't change between (non-changing) builds
formatOptions: { ttf: { ts: 0 } },
types: ['woff2'],
templateOptions: {
classPrefix: 'wui-icon-',
baseSelector: 'i',
Expand Down
6 changes: 3 additions & 3 deletions scripts/webfont-deploy.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/bin/bash

FONTS_DIR=packages/IconFont/fonts
FONT_FILE="$FONTS_DIR/welcome-icon-font.woff"
FONT_FILE="$FONTS_DIR/welcome-icon-font.woff2"

if [[ -f "$FONT_FILE" ]]; then
ICON_FONT_HASH=$(sha1sum $FONT_FILE | awk '{ print $1 }')

echo "Copying fonts to s3://welcome-ui/public/fonts/icon-font/$ICON_FONT_HASH/"

aws s3 sync $FONTS_DIR s3://welcome-ui/public/fonts/icon-font/$ICON_FONT_HASH/
aws s3 sync $FONTS_DIR s3://welcome-ui/public/fonts/icon-font/$ICON_FONT_HASH/ --cache-control 'public, max-age=31536000' --exclude '*' --include 'welcome-icon-font.woff2'

echo "Copying fonts to s3://wttj-production/fonts/icon-font/$ICON_FONT_HASH/"

aws s3 sync $FONTS_DIR s3://wttj-production/fonts/icon-font/$ICON_FONT_HASH/
aws s3 sync $FONTS_DIR s3://wttj-production/fonts/icon-font/$ICON_FONT_HASH/ --cache-control 'public, max-age=31536000' --exclude '*' --include 'welcome-icon-font.woff2'
else
echo "Font doesn't exist. Please run 'yarn webfont:build'"
exit 1
Expand Down

0 comments on commit a8624d3

Please sign in to comment.