-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add publicly accessibly font file for easy import into projects #1
Comments
Also, you should probably change the |
Thanks @noClaps! These are all very valid points. Your naming conventions really helped me think about this when I put those fonts on a CDN (or someone else does it for us) The current setup we have is optimal for NextJS, when we deploy we deploy a server, and the generation of of our build folder happens in real time, nothing is used as is. I know this isn't obvious when you look at a NextJS repository, but everything is very optimized in the final asset delivery in the client. The |
Where are you hosting it? A lot of services give you free static site hosting, and that usually comes with a lot of bandwidth. I'm also not sure why the CPU would be involved in serving static files. If the website isn't static, however, then I think you should consider making it static, since there's nothing on there that requires it to be SSR, from what I can tell. Alternatively, you can host the font and CSS files on a CDN that points to a subdomain, like For example, if the font and CSS files are being served from Plus, the files coming from the official |
We deploy our sites between Render and Vercel. We don't use a static host at the moment but your comment has made me consider doing it, since even some of our clients want static sites. I do need to setup a CDN for all of our assets, this is a good point. |
Both Render and Vercel do static site hosting. I've hosted static sites on Vercel before, and I'm currently hosting all of my static sites on Render. I believe this is the value you need to change in your configuration to make your current site static. |
Inter uses a font file at https://rsms.me/inter/inter.css to host the Inter font files for everyone using the project. This makes it really easy to use it, since it's a simple
@import
into your CSS file to use. I'd like if this could also be done for Server Mono.The code in
globals.scss
:www-server-mono/global.scss
Lines 1 to 9 in af527d3
should be copied/separated into a separate CSS file that will not be bundled into the static output. I'm not familiar with Next.js but I imagine this would be in the
public/
directory.The code should be:
Also, since the
woff2
files are available, and it's only IE that doesn't support it, you can change the font file and format towoff2
. You can also list multipleurl
andformat
values insidesrc
if you'd like to have both or multiple formats. The user's browser will pick the best supported format automatically.These can also be pointed to the locally built files rather than to AWS, but that's up to you. Simply adding the font files to the
public/
directory, or whatever copies the files directly to the output, should work. The benefit for users is that it's one less request they have to make to load the font, since with the current setup it would first make a request to https://servermono.com to fetch the CSS, and then make a request to amazonaws.com to fetch the font files.You can see Inter's CSS file linked above for reference on how this can be set up.
The text was updated successfully, but these errors were encountered: