Skip to content

Commit

Permalink
chore: attempt async setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Luqmaan Essop committed Apr 8, 2024
1 parent f45d5c8 commit bffa19b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions apps/website/gatsby-ssr.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Locale, registerExecutor } from '@custom/schema';
import { loadFonts } from '@custom/ui/fonts-async';
import { GatsbySSR } from 'gatsby';
import React from 'react';

Expand Down
3 changes: 3 additions & 0 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
],
"./styles.css": [
"./build/styles.css"
],
"./fonts-async": [
"./build/fonts-async.js"
]
},
"typesVersions": {
Expand Down
8 changes: 0 additions & 8 deletions packages/ui/src/components/Atoms/Fonts.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
@font-face {
font-family: 'Noto Sans';
src: url("/fonts/NotoSansGurmukhi-Regular.woff2") format("woff2");
font-weight: 400;
font-style: normal;
font-display: block;
}

html, body {
font-family: 'Noto Sans', 'Helvetica', sans-serif;
}
4 changes: 4 additions & 0 deletions packages/ui/src/postcss.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@ module.exports = {
'.gutenberg__editor .edit-post-visual-editor__content-area',
}[process.env.PREFIX] || '',
},
'postcss-font-magician': {
hosted: ['../static/public/fonts'],
// async: '../static/public/fonts-async.js',
}
},
};
7 changes: 7 additions & 0 deletions packages/ui/static/public/fonts-async.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function loadFonts(fontFaces) {
console.log('hi from font loader')
return fontFaces;
}

// Export the loadFonts function for use in the PostCSS configuration
module.exports = {loadFonts};

0 comments on commit bffa19b

Please sign in to comment.