-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for self-hosted fonts #10
feat: add support for self-hosted fonts #10
Conversation
@hupe1980 could you take look at this and give your feedback on it? |
|
||
export default async function webFonts(options) { | ||
const modules = { | ||
google: google(options), | ||
selfHosted: selfHosted(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's exactly how it was intended
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. That looks really good ...
@hupe1980 I just added a support of custom CSS properties to allow users customize them to their needs instead of hardcoding just a few. Now anything other than |
|
||
export default async function webFonts(options) { | ||
const modules = { | ||
google: google(options), | ||
selfHosted: selfHosted(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The options have to be passed here. For example for the pathprefix...
See https://github.com/hupe1980/gatsby-plugin-webfonts/tree/master/e2e-tests/path-prefix-prod-runtime
const getFontFace = async font => { | ||
const { family, urls, ...cssProperties } = createFontOptions(font); | ||
|
||
const { css } = await postcss().process(cssProperties, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Top!
{ | ||
family: `Open Sans`, | ||
urls: { | ||
woff2: `/OpenSans400.woff2`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We assume the fonts are in static folder and copied to the app root.
Here I am not sure if it would be better to specify the font file source.
src: {
woff2: path.join('static', `OpenSans400.woff2'),
}
What do you think?
Can we get a status update on this PR? Thnx |
@hupe1980 can we help you? I'd love to see this feature added to plugin-webfonts. I can offer coding support, rubber ducking, cheering you up in a video call and sending some bavarian beer 🙃 (I do maintain multiple Gatsby plugins, so I guess I could be a helpful hand) |
@axe312ger Help would be great! You are welcome to take over the pull request. @visualfanatic currently seems to have no more time. |
I'll add it to the "things I might hack on Christmas" list 🙃 |
@hupe1980 can you maybe assign me? Helps me not forgetting about it :) |
@axe312ger I have assigned you. Thx for your support |
@axe312ger Any updates on this? |
@hupe1980 busy with earning money, so, no progress yet. Still wanna do it. If a client needs static font files, I might be able to do it within a project. Can't tell yet :) If anybody else wanna code it, feel free to do it! I will put a note into this PR as soon I start working on it! |
Any update on this? Would be awesome to have this feature 🙂 |
I won't find time soon. Anybody else feel tree to take this over. Would be a real great new feature for this plugin! Alternative: Make me find time by paying me for this feature ;) |
I can't pay you but I am going to have a crack at this myself as |
This PR adds a basic support for self-hosted fonts.
TODO:
Fixes #5