Flask-FontAwesome

Flask-FontAwesome adds FontAwesome to your Flask app.

Quick Start

from flask import Flask, render_template
from flask_fontawesome import FontAwesome

app = Flask(__name__)
fa = FontAwesome(app)

@app.route('/')
def index():
    return render_template('index.html')

app.run(host='127.0.0.1', port=8080)
<!DOCTYPE html>
<html>
  <head>
    {{ fontawesome_css() }}
    <title>FontAwesome Example</title>
  </head>
  <body>
    <h1>FontAwesome Example</h1>
    <p>This is an example of a <span class="fas fa-link"></span> link.</p>
    {{ fontawesome_js() }}
  </body>
</html>

API Docs

class flask_fontawesome.FontAwesome(app: flask.app.Flask = None)[source]
init_app(app: flask.app.Flask) → None[source]

Jinja Functions

flask_fontawesome.fontawesome_html() → markupsafe.Markup[source]

Returns Markup of all the requested FontAwesome resources. This can be embedded in your Jinja templates to add FontAwesome to your site.

flask_fontawesome.fontawesome_css() → markupsafe.Markup[source]

Returns :class`~flask.Markup` of the CSS FontAwesome resources.

flask_fontawesome.fontawesome_js() → markupsafe.Markup[source]

Returns Markup of the JS FontAwesome resources.

Configuration

Flask-FontAwesome has a few configurations.

Option Default  
FONTAWESOME_INCLUDE_V4_SHIMS False Whether or not to include the v4 shims.
FONTAWESOME_QUERYSTRING_REVVING True If True, serve FontAwesome resources with an appended query string to ensure cache busting on upgrade.
FONTAWESOME_SERVE_LOCAL True If True, serve from /static, else https://use.fontawesome.com.
FONTAWESOME_STYLES solid Type: list, options: all , regular, solid, brands. Which FontAwesome resources to load.
FONTAWESOME_TYPE webfont/css Options: webfont/css or svg/js.
FONTAWESOME_USE_MINIFIED True Whether or not to use the minified versions of the resources.

Full API

Full API Docs cover basic usage of this package.