Created
August 11, 2016 18:07
-
-
Save steffenr/303c8ee147f9e7983de35557f35c5ae1 to your computer and use it in GitHub Desktop.
Embed external fonts in Drupal 8 theme (fonts are added in custom themename.libraries.yml)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Theme name | |
type: theme | |
description: Theme description | |
package: Custom | |
core: 8.x | |
libraries: | |
- themename/fonts | |
- themename/global-styling | |
base theme: classy | |
# Regions | |
regions: | |
header: 'Header' | |
primary_menu: 'Navigation' | |
highlighted: 'Preface' | |
content: 'Content' | |
footer: 'Footer' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fonts: | |
license: | |
name: Apache License, 2.0 | |
url: http://www.apache.org/licenses/LICENSE-2.0.html | |
css: | |
theme: | |
'//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800': { type: external } | |
global-styling: | |
version: 1.x | |
css: | |
theme: | |
css/bootstrap/bootstrap.min.css: {} | |
css/custom.css: {} | |
js: | |
js/bootstrap.min.js: {} | |
js/custom.js: {} | |
dependencies: | |
- core/jquery | |
- core/jquery.once |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's how I did it for local fonts as well. I just added the fonts.css to the mytheme.libraries.yml file under global-styling and that's all. The fonts files and fonts.css are in theme/assets/fonts/ and the fonts.css has the fonts info and local urls.
Only one of my 4 used fonts is working though and I have yet to figure out why the rest aren't working !!!
Anyone here at all :-/