pacollins / calligraphy

Calligraphy is a theme for Hugo static site generator focused on the beauty of it's content.
https://hugo-calligraphy.netlify.app/
MIT License
27 stars 9 forks source link

Google fonts not being displayed #6

Closed algoexpt closed 2 years ago

algoexpt commented 2 years ago

Because of the way the scss is generated, the @import statement is appearing somewhere in the middle, after the normalize and toc imports.

Moving the @import of googlefonts to the first line (in the browser developer tools) fixes this, we do see the Google fonts correctly.

My gut feeling is this is to do with the sequence in which the scss file is generated (not sure, not a front end developer).

Can you please take a look and make a fix?

I love your theme! Screenshot_20220702_003858

Font is not displayed because first line is not the import from google fonts

Screenshot_20220702_003925

Font displayed correctly when import from google fonts is the first line

pacollins commented 2 years ago

I will look into this, but I think you are right. I bet I didn't notice when I made changes because it was cached. I'll try to patch that today.

On Fri, Jul 1, 2022 at 11:40 AM algoexpt @.***> wrote:

Because of the way the scss is generated, the @import https://github.com/import statement is appearing somewhere in the middle, after the normalize and toc imports.

Moving the @import https://github.com/import of googlefonts to the first line (in the browser developer tools) fixes this, we do see the Google fonts correctly.

My gut feeling is this is to do with the sequence in which the scss file is generated (not sure, not a front end developer).

Can you please take a look and make a fix?

I love your theme! [image: Screenshot_20220702_003858] https://user-images.githubusercontent.com/22828481/176926509-6dec6345-44c0-4bc8-8c0d-f1f5514199d2.png

Font is not displayed because first line is not the import from google fonts

[image: Screenshot_20220702_003925] https://user-images.githubusercontent.com/22828481/176926591-e80b9877-99d8-40dd-9c74-e1d051e8ca22.png

Font displayed correctly when import from google fonts is the first line

— Reply to this email directly, view it on GitHub https://github.com/pacollins/calligraphy/issues/6, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWVJSL2423XVSFCJQEPMTTVR4GPVANCNFSM52NDRZKA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

pacollins commented 2 years ago

@algoexpt - If you would be so kind as to check the PR, I'll go ahead and merge! I took the opportunity to also include font files into the theme for those who prefer to not use CDNs.

algoexpt commented 2 years ago

Checked, and it works! Good idea to include font files in static as well. Thanks!

algoexpt commented 2 years ago

Sorry one more question. I changed the default font-body in data/styles.toml like so:

font-header = "'Playfair Display', serif"
font-body = "'Gentium Book Basic', serif"

However the changes don't take effect - the font goes back to the default font.

As you can see, main.min doesn't have the @font-face code to enable gentium book basic as the font:

Screenshot_20220703_121758

Is this the wrong way to set the default font?