Skip to content

Commit

Permalink
Include Academicons webfonts
Browse files Browse the repository at this point in the history
  • Loading branch information
janheinrichmerker committed Mar 3, 2024
1 parent c86bed0 commit 13a4ec7
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 18 deletions.
2 changes: 2 additions & 0 deletions assets/css/_fonts.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@use "fonts/fontawesome";
@use "fonts/academicons";
1 change: 1 addition & 0 deletions assets/css/fonts/_academicons.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@use "../../node_modules/academicons/css/academicons";
6 changes: 6 additions & 0 deletions assets/css/fonts/_fontawesome.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

$fa-font-path: "/fonts";
@import "../node_modules/@fortawesome/fontawesome-free/scss/fontawesome";
@import "../node_modules/@fortawesome/fontawesome-free/scss/brands";
@import "../node_modules/@fortawesome/fontawesome-free/scss/solid";
@import "../node_modules/@fortawesome/fontawesome-free/scss/regular";
17 changes: 5 additions & 12 deletions assets/css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,12 @@ $font-family-head: "Space Mono";
$font-size: 14pt;
$font-size-icon: 1em;

@import "functions";
@use "functions";
@use "fonts";
@use "code";
@use "../node_modules/normalize-scss/sass/normalize";

@import url("https://fonts.googleapis.com/css2?family=#{str-replace($font-family-body, " ", "+")}:ital,wght@0,400;0,700;1,400&family=#{str-replace($font-family-head, " ", "+")}:ital,wght@0,400;0,700;1,400&display=swap");

@import "../node_modules/normalize-scss/sass/normalize";

$fa-font-path: "/webfonts/fontawesome/";
@import "../node_modules/@fortawesome/fontawesome-free/scss/fontawesome.scss";
@import "../node_modules/@fortawesome/fontawesome-free/scss/brands.scss";
@import "../node_modules/@fortawesome/fontawesome-free/scss/solid.scss";
@import "../node_modules/@fortawesome/fontawesome-free/scss/regular.scss";

@import "code";
@import url("https://fonts.googleapis.com/css2?family=#{$font-family-body}:ital,wght@0,400;0,700;1,400&family=#{$font-family-head}:ital,wght@0,400;0,700;1,400&display=swap");

body {
display: flex;
Expand Down
15 changes: 9 additions & 6 deletions layouts/partials/site/styles.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
{{- $style := resources.Get "/css/main.scss" | resources.ToCSS $options -}}
<link rel="stylesheet" href="{{ $style.Permalink }}">

{{/* Publish Font Awesome web fonts. */}}
{{- $fontawesomeWebfonts := resources.Match "/node_modules/@fortawesome/fontawesome-free/webfonts/*" -}}
{{- range $fontawesomeWebfonts -}}
{{- $name := .Name | strings.TrimPrefix "/node_modules/@fortawesome/fontawesome-free/webfonts/" | printf "/webfonts/fontawesome/%s" -}}
{{- with resources.Copy $name . -}}
{{- .Publish -}}
{{/* Publish fonts. */}}
{{- $fontsPathPrefixes := collections.Slice "/node_modules/@fortawesome/fontawesome-free/webfonts/" "/node_modules/academicons/fonts/" -}}
{{- range $fontsPathPrefix := $fontsPathPrefixes -}}
{{- $fonts := resources.Match (printf "%s/*" $fontsPathPrefix) -}}
{{- range $fonts -}}
{{- $name := .Name | strings.TrimPrefix $fontsPathPrefix | printf "/fonts/%s" -}}
{{- with resources.Copy $name . -}}
{{- .Publish -}}
{{- end -}}
{{- end -}}
{{- end -}}

0 comments on commit 13a4ec7

Please sign in to comment.