Skip to main content

A simple Tag to implement Feather Icons in Flask

Project description

Flask Feather

A simple Tag ({% icon "name" %}) to implement Feather Icons in Flask. This is largely based of the library django_feather by Jonas Drotleff.

Install

Install flask-feather using pip.

pip install flask-feather

Quick Start

Firstly, initialise the extension within your Flask context

from flask_feather import Feather
feather = Feather(app)

This extension also supports the Flask application factory pattern by allowing you to create a Feather object and then initialised it separately for an app:

feather = Feather()

def create_app(config):
    app = Flask(__name__)
    app.config.from_object(config)

    feather.init_app(app)

Usage

It's pretty simple to use this package. From within a jinja template:

<p>{{ feather.icon('icon-name', width=32, height=32) }}</p>

The icon function takes the SVG source from the Feather project, applies additional attributes and return the SVG tag.

Performance

flask-feather borrows the application structure from django-feather and does not read the .svg files each time an icon is rendered. Instead, on installation, all the icons are written to a .py file. All icons are rendered on the server side, avoiding the need to call feather.replace() after the page has loaded.

License

Feather is licensed under the MIT License.

flask-feather is a derivative work of django-feather, both of which are licensed under the Apache License, Version 2.0:

    Modifications Copyright 2020 Tom Vos <tjvos1@gmail.com>

    Original Django-feather Copyright 2020 Jonas Drotleff <j.drotleff@desk-lab.de>

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask-feather-0.0.1.tar.gz (7.8 kB view hashes)

Uploaded Source

Built Distribution

flask_feather-0.0.1-py3-none-any.whl (18.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page