A utility function which helps to inline fontawesome SVG files.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
specs
.gitignore
.npmignore
.travis.yml
LICENSE
README.md
index.js
package-lock.json
package.json

README.md

hexo-fontawesome

A plugin for static pages generator Hexo. A utility function which helps to inline fontawesome SVG files.

Installation

Easy way

Install this plugin and all free font-awesome styles:

npm i hexo-fontawesome --save

Advanced way

Install just a plugin:

npm i hexo-fontawesome --no-optional --save

Then you need to manually install all needed styles:

npm i @fortawesome/fontawesome-free-solid --save
npm i @fortawesome/fontawesome-free-regular --save
npm i @fortawesome/fontawesome-free-brands --save

Usage

In theme

This plugin adds a view helpers you can use in the theme to include inline SVG icons from the font-awesome collection.

fa_css()

Returns inline styles needed for the inline SVGs.

Example usage:

<style>
  <%- fa_css() %>
</style>

fa_inline(iconName, options)

Returns an SVG markup of the chosen icon.

Possible options:

  • prefix - the style prefix, fab for brands, fas for solid etc. Defaults to fas
<%- fa_inline('twitter', {prefix: 'fab'}) %>

In post

This plugin adds a tag that you can use in the theme to include inline SVG icons from the font-awesome collection.

{% fa_css %}

Returns inline styles needed for the inline SVGs.

Example usage:

# My
## Post
### Content
#### Here

{% fa_css %}

{% fa_inline iconName [prefix] %}

Returns an SVG markup of the chosen icon. prefix is the style prefix, fab for brands, fas for solid etc. Defaults to fas

Example usage:

# My
## Post
### Content
{% fa_inline twitter fab %}
#### Here


{% fa_css %}