0.0.3 • Published 8 months ago

hexo-fontawesome-icons v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

hexo-fontawesome-icons

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

Installation

Requirements

  • NodeJS at least 6.x

CLI

Install this plugin and all free font-awesome styles:

npm install hexo-fontawesome-icons --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>

in EJS template or

<style>
  {{ fa_css() }}
</style>

in NunJucks tempalte

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 EJS template
{{ fa_inline('twitter', { prefix: 'fab' }) }}  // in NunJucks template

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 %}

Acknowledgments

Special thanks to hexojs for creating the original hexo-fontawesome on which this project is based.