3

I use drupal 8, and Bootstrap theme.

I created a sub-theme.

I would like added one font that I downloaded, to use it in my sub-theme.

I read contradictory things to realize it. For example that it was enough to create a folder "font" in its sub-theme, and add the font in it, then add it in mytheme.libraries.yml, or that it was necessary to place this font in the folder vendor/ . I am a little lost.

How can it be done?

  • Please add more information about what the contradictory things were and what you have tried. – joshmiller Feb 4 '16 at 16:37
  • I read for example that it was enough to create a folder "font" in his sub-theme, and add the font in it, then add it in mytheme.libraries.yml, or that it was necessary to place this font in the folder vendor/ . I am a little lost – Fluidouix Feb 4 '16 at 16:43
1

I followed this guide on Google Fonts to get it to work with my downloaded font. In your case that would be editing your info file to declare that you have fonts assets:

name: Subboot
description: Bootstrap Subtheme
type: theme
base theme: bootstrap
core: 8.x
libraries:
  - subboot/fonts

then edit the libraries.yml in your subtheme, ex. subboot.libraries.yml to add in the following:

fonts:
  css:
    theme:
      //your.domain.com/path/to/font {}
  • It doesn't work for me, I put the font file in woff format at fonts directory of my subtheme. Do I have to define it or specify it anywhere else? my library declaration is like this: fonts: css: theme: //fonts {} – ferriol Jan 25 '17 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.