Discourse FontAwesome Pro

:discourse2: Summary Discourse FontAwesome Pro allows the use of Font Awesome Pro icons in Discourse with a FontAwesome license by using your account’s NPM package token.
:hammer_and_wrench: Repository Link https://github.com/discourse/discourse-fontawesome-pro
:open_book: Install Guide How to install plugins in Discourse

Configuration

This requires a few extra step to enable from a normal plugin:

First, you will need to set up an additional env var containing your font awesome pro license key: DISCOURSE_FONTAWESOME_AUTH_TOKEN

The install script also needs to be called during initialization, as an additional “after_code” hook. This downloads and adds the FontAwesome Pro SVGs on build using your auth token. This is an additional block separate from the plugin clone block.

Here is an example install in app.yml :

env:
  DISCOURSE_FONTAWESOME_AUTH_TOKEN: 123456
  
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/discourse-fontawesome-pro.git
    - exec:
        cd: $home/plugins/discourse-fontawesome-pro
        raise_on_fail: false
        cmd:
          - $home/plugins/discourse-fontawesome-pro/scripts/install.sh

Picking an override style:

In the admin settings there is now an option to override the default Discourse icons with your own style:

Screenshot from 2020-05-10 11-34-26

Duotone

To take full control of duotone support, you will be looking to override the following CSS (in a theme, or otherwise) and replace it with your own color scheme:

svg .fa-secondary {
  opacity: 0.6;
}

To color individual icons reference the SVG’s ID:

#fad-search .fa-secondary {
  color: red;
}

Under the hood, this is using FontAwesome’s repository to install fonts to the plugin’s SVG folder, and lets Discourse pick up the sprites from there.

CHANGELOG

TODO

28 Likes

Hey @featheredtoast. I spent what feld like all day trying to fix Rebuild Failed, please help!, which turned out to be that they had included the plugin in the regular plugin block. I added a bit to the OP to warn others.

Also, it’s rather fussy to include a block like that in the app.yml (though it pasted in just fine for me). I think that it would be nice if there were a template that one could include rather than adding this block.

That was wrong. I hadn’t realized that the plugins were already installed in after_code. My “fix” I now think was just rubygems deciding that I could have code again. This seemed far-fetched because I was working on two separate droplets, one new, in two different data centers (though both in SFO).

3 Likes