Home

Awesome

Font Awesome component for Vuepress

This plugin allows you to use Font Awesome icons in Vuepress markdown file directly.

Support regular and solid icons ONLY


How to Use

Each icon's used as a Vuepress component, so you just need to input a directive start with Fa- then follow the Capitalised font awesome icon class name, for example:

<!-- Insert a address book icon, red colour, 3x large size -->
<Fa-AddressBook color="red" size="3x" />

Install

yarn add vuepress-plugin-font-awesome
  "scripts": {
    "fa:build": "node node_modules/vuepress-plugin-font-awesome/index.js"
  }

Generate Font Awesome components

Generate all font awesome icon components

Simply run following command:

yarn fa:build

If in your project, you root folder is in other place, for example: 'docs', then pass the dest option:

yarn fa:build --dest=docs

The plugin will put the font awesome components in right place, which is .vuepress/components/Fa.

Generate specified icons only

By default, there are 152 regular and 957 solid icon components will be generated, which is a huge amount. Instead of pack them all, you might want to only generate some specified icons based on your demand. To do so, simply put them in the .vuepress/config.js file as below:

module.exports = {
    title: 'Hello VuePress',
    description: 'Just playing around',

    // Please append following lines into your config.js
    thirdPartyComponents: {
        fontAwesomeIcons:{
            regular:['address-card','file-audio'],  // Regular font awesome icon keys here
            solid:['battery-quarter']               // Solid font awesome icon keys here
        }
    }
  }

If you don't know what icon's key you could use, please refer the following:

The command is exactly same as above:

yarn fa:build

OR

yarn fa:build --dest=$YOUR_DOCS

Use Font Awesome in your markdown

In any of your markdown file, simply add:

<Fa-AddressBook />

Add props to icon:

<Fa-AddressBook color="red" size="3x" />

Here below are props you could pass:


Change Log