A
A
Andrej Sharapov2019-09-05 09:09:33
Layout
Andrej Sharapov, 2019-09-05 09:09:33

Link or import fonts?

Good morning everyone and have a nice day.
I make the site static on PUG + SCSS and select the optimal fonts for the site. Hence a few questions:
How best to do:
1. register a link in the template, setting the font itself as a variable + add styles for the body in it?

- var fontGlob = 'Roboto'
    link(rel="stylesheet", href='https://fonts.googleapis.com/css?family=' + fontGlob + '|Montserrat&display=swap')
    style.
        body {font-family: '#{fontGlob}', sans-serif;}

2. or register import in scss and select fonts through a variable?
This doesn't work at all:
@import 'https://fonts.googleapis.com/css?family= + #{$fontGlob} + |Montserrat&display=swap'
$fontGlob: 'Roboto'
body {font-family: '#{$fontGlob}', sans-serif;}

Hence the next question - how then to be with compound fonts? for example Josefin+Sans.
How are you doing and how will it be better? For the site, of course, it would be better to write a link and put the styles in a file, but while the selection is in progress, xs.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Eugene, 2019-09-05
@iamd503

Upload fonts to your site and include them in css

A
Alexey, 2019-09-05
@AleksRap

all fonts, libraries, etc. must be connected locally so that their display is not affected by the availability of another server. Connect later in a separate scss file with import into the main one

A
Alexander, 2019-09-05
@tomclancys

Option 2 is the best I think.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question