antonlegoo / gitbook-plugin-theme-gestalt

A configurable theme for GitBook.
Apache License 2.0
17 stars 11 forks source link

Fonts URL is Relative instead of Absolute #5

Closed michaeltlombardi closed 6 years ago

michaeltlombardi commented 6 years ago

I've been playing around with the gestalt theme recently and noticed that the fontawesome icons weren't showing correctly - I had to go in and alter the path to the font files from ./gitbook/... to /gitbook/....

Running a build without any changes:

Errors with file paths

Fontawesome icons not rendering:

Fontawesome icons not rendering

This is the combiled gitbook/style.css: Compiled `gitbook/style.css`

And then I update gitbook/style.css:

Visible icons

And here's the gitbook/style.css after my 'fix':

Fixed `gitbook/style.css`

For reference, here's the gitbook config:

{
  "plugins": ["theme-gestalt", "expandable-chapters"],
  "pluginsConfig": {
    "theme-gestalt": {
        "logo": "/img/logo.png",
        "favicon": "/img/favicon.png",
        "doNotHideChildrenChapters" : true
    }
  },
  "root": "docs"
}
michaeltlombardi commented 6 years ago

It looks like that is related to this line which sets the $fa-font-path.

antonlegoo commented 6 years ago

@michaeltlombardi thanks for pointing this out. I've made an update that makes the Font Awesome path a variable. So in your website.scss you can overwrite the path such as:

@import "../node_modules/gitbook-plugin-theme-gestalt/src/scss/variables";

$path-font-awesome : "/gitbook/fonts/fontawesome";

@import "../node_modules/gitbook-plugin-theme-gestalt/src/scss/all";
michaeltlombardi commented 6 years ago

Awesome, thanks! :)