Font-Awesome-Flask


NameFont-Awesome-Flask JSON
Version 0.1.2 PyPI version JSON
download
home_pageNone
SummaryFont-Awesome-Flask is an extension for Flask that adds support for Font Awesome to your web application.
upload_time2023-09-05 18:36:28
maintainerNone
docs_urlNone
authorNone
requires_python~=3.8
licenseNone
keywords flask extension font awesome
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!-- start docs-include-index -->

# Font-Awesome-Flask

[![PyPI](https://img.shields.io/pypi/v/Font-Awesome-Flask)](https://img.shields.io/pypi/v/Font-Awesome-Flask)
[![Supported Python Versions](https://img.shields.io/pypi/pyversions/Font-Awesome-Flask)](https://pypi.org/project/Font-Awesome-Flask/)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/sgraaf/font-awesome-flask/main.svg)](https://results.pre-commit.ci/latest/github/sgraaf/font-awesome-flask/main)
[![Documentation Status](https://readthedocs.org/projects/font-awesome-flask/badge/?version=latest)](https://font-awesome-flask.readthedocs.io/en/latest/?badge=latest)
[![PyPI - License](https://img.shields.io/pypi/l/Font-Awesome-Flask)](https://img.shields.io/pypi/l/Font-Awesome-Flask)

Font-Awesome-Flask is an extension for [Flask](https://flask.palletsprojects.com/en/latest/) that adds support for [Font Awesome](https://fontawesome.com/) to your web application. It adds methods to load Font Awesome's resources (both `Web Fonts + CSS` and `SVG + JS` are supported) and render icons.

<!-- end docs-include-index -->

## Installation

<!-- start docs-include-installation -->

### From PyPI

Font-Awesome-Flask is available on [PyPI](https://pypi.org/project/Font-Awesome-Flask/). Install with `pip` or your package manager of choice:

```bash
pip install Font-Awesome-Flask
```

### From source

If you'd like, you can also install Font-Awesome-Flask from source (with [`flit`](https://flit.readthedocs.io/en/latest/)):

```bash
git clone https://github.com/sgraaf/font-awesome-flask.git
cd font-awesome-flask
python3 -m pip install flit
flit install
```

<!-- end docs-include-installation -->

## Documentation

Check out the [Font-Awesome-Flask documentation](https://font-awesome-flask.readthedocs.io/en/stable/) for the [User's Guide](https://font-awesome-flask.readthedocs.io/en/stable/usage.html) and [API Reference](https://font-awesome-flask.readthedocs.io/en/stable/api.html).

## Example

### Configuration

Font-Awesome-Flask can be configured via the [Flask configuration API](https://flask.palletsprojects.com/en/latest/config/), using the `config` attribute of the `Flask` object. These are the available configuration values along with their description:

| Configuration value        | Default | Description                                                        |
| -------------------------- | ------- | ------------------------------------------------------------------ |
| `FONT_AWESOME_SERVE_LOCAL` | `False` | Whether to serve Font Awesome's resources locally or from the CDN. |

### Initialization

<!-- start docs-include-initialization -->

Initialize the extension with the Flask application normally...:

```python
from flask import Flask
from flask_font_awesome import FontAwesome

app = Flask(__name__)
font_awesome = FontAwesome(app)
```

... or using the [Application Factory](https://flask.palletsprojects.com/en/latest/patterns/appfactories/) pattern:

```python
from flask import Flask
from flask_font_awesome import FontAwesome

font_awesome = FontAwesome()


def create_app():
    app = Flask(__name__)
    font_awesome.init_app(app)
    return app
```

<!-- end docs-include-initialization -->

### Loading resources

Font-Awesome-Flask provides three helper methods to load Font Awesome's resources: `font_awesome.load()`, `font_awesome.load_js()` and `font_awesome.load_css()`.

Font Awesome can be used either via [Web Fonts + CSS or via SVG + JS](https://fontawesome.com/docs/web/dig-deeper/webfont-vs-svg). Use the `load_css()` method for the former, and `load_js()` for the latter. You can also use the more general `load()`, which defaults to `SVG + JS`.

Whichever resource(s) you end up using, you can load them by including any of the `load()` methods in the head of your base template:

<!-- prettier-ignore -->
```html
<head>
    ...
    {{ font_awesome.load_js() }}
    ...
</head>
<body>
    ...
</body>
```

### Rendering icons

Font-Awesome-Flask provides two ways of rendering icons: via the `font_awesome.render_icon()` and `font_awesome.render_stacked_icons()` methods...:

```python
{{font_awesome.render_icon("fas fa-house")}}
{{font_awesome.render_stacked_icons("fas fa-square", "fas fa-house")}}
```

... or via the [Jinja macros](https://jinja.palletsprojects.com/en/latest/templates/#macros) of the same names:

```
{% from 'font_awesome.html' import render_icon, render_stacked_icons %}
{{ render_icon('fas fa-house') }}
{{ render_stacked_icons('fas fa-square', 'fasfa-house') }}
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "Font-Awesome-Flask",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "~=3.8",
    "maintainer_email": null,
    "keywords": "flask,extension,font awesome",
    "author": null,
    "author_email": "Steven van de Graaf <steven@vandegraaf.xyz>",
    "download_url": "https://files.pythonhosted.org/packages/79/c3/e6ee7614ec55f5ec6705633fc59896d053d982a8c58272503029d6b3fa88/font_awesome_flask-0.1.2.tar.gz",
    "platform": null,
    "description": "<!-- start docs-include-index -->\n\n# Font-Awesome-Flask\n\n[![PyPI](https://img.shields.io/pypi/v/Font-Awesome-Flask)](https://img.shields.io/pypi/v/Font-Awesome-Flask)\n[![Supported Python Versions](https://img.shields.io/pypi/pyversions/Font-Awesome-Flask)](https://pypi.org/project/Font-Awesome-Flask/)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/sgraaf/font-awesome-flask/main.svg)](https://results.pre-commit.ci/latest/github/sgraaf/font-awesome-flask/main)\n[![Documentation Status](https://readthedocs.org/projects/font-awesome-flask/badge/?version=latest)](https://font-awesome-flask.readthedocs.io/en/latest/?badge=latest)\n[![PyPI - License](https://img.shields.io/pypi/l/Font-Awesome-Flask)](https://img.shields.io/pypi/l/Font-Awesome-Flask)\n\nFont-Awesome-Flask is an extension for [Flask](https://flask.palletsprojects.com/en/latest/) that adds support for [Font Awesome](https://fontawesome.com/) to your web application. It adds methods to load Font Awesome's resources (both `Web Fonts + CSS` and `SVG + JS` are supported) and render icons.\n\n<!-- end docs-include-index -->\n\n## Installation\n\n<!-- start docs-include-installation -->\n\n### From PyPI\n\nFont-Awesome-Flask is available on [PyPI](https://pypi.org/project/Font-Awesome-Flask/). Install with `pip` or your package manager of choice:\n\n```bash\npip install Font-Awesome-Flask\n```\n\n### From source\n\nIf you'd like, you can also install Font-Awesome-Flask from source (with [`flit`](https://flit.readthedocs.io/en/latest/)):\n\n```bash\ngit clone https://github.com/sgraaf/font-awesome-flask.git\ncd font-awesome-flask\npython3 -m pip install flit\nflit install\n```\n\n<!-- end docs-include-installation -->\n\n## Documentation\n\nCheck out the [Font-Awesome-Flask documentation](https://font-awesome-flask.readthedocs.io/en/stable/) for the [User's Guide](https://font-awesome-flask.readthedocs.io/en/stable/usage.html) and [API Reference](https://font-awesome-flask.readthedocs.io/en/stable/api.html).\n\n## Example\n\n### Configuration\n\nFont-Awesome-Flask can be configured via the [Flask configuration API](https://flask.palletsprojects.com/en/latest/config/), using the `config` attribute of the `Flask` object. These are the available configuration values along with their description:\n\n| Configuration value        | Default | Description                                                        |\n| -------------------------- | ------- | ------------------------------------------------------------------ |\n| `FONT_AWESOME_SERVE_LOCAL` | `False` | Whether to serve Font Awesome's resources locally or from the CDN. |\n\n### Initialization\n\n<!-- start docs-include-initialization -->\n\nInitialize the extension with the Flask application normally...:\n\n```python\nfrom flask import Flask\nfrom flask_font_awesome import FontAwesome\n\napp = Flask(__name__)\nfont_awesome = FontAwesome(app)\n```\n\n... or using the [Application Factory](https://flask.palletsprojects.com/en/latest/patterns/appfactories/) pattern:\n\n```python\nfrom flask import Flask\nfrom flask_font_awesome import FontAwesome\n\nfont_awesome = FontAwesome()\n\n\ndef create_app():\n    app = Flask(__name__)\n    font_awesome.init_app(app)\n    return app\n```\n\n<!-- end docs-include-initialization -->\n\n### Loading resources\n\nFont-Awesome-Flask provides three helper methods to load Font Awesome's resources: `font_awesome.load()`, `font_awesome.load_js()` and `font_awesome.load_css()`.\n\nFont Awesome can be used either via [Web Fonts + CSS or via SVG + JS](https://fontawesome.com/docs/web/dig-deeper/webfont-vs-svg). Use the `load_css()` method for the former, and `load_js()` for the latter. You can also use the more general `load()`, which defaults to `SVG + JS`.\n\nWhichever resource(s) you end up using, you can load them by including any of the `load()` methods in the head of your base template:\n\n<!-- prettier-ignore -->\n```html\n<head>\n    ...\n    {{ font_awesome.load_js() }}\n    ...\n</head>\n<body>\n    ...\n</body>\n```\n\n### Rendering icons\n\nFont-Awesome-Flask provides two ways of rendering icons: via the `font_awesome.render_icon()` and `font_awesome.render_stacked_icons()` methods...:\n\n```python\n{{font_awesome.render_icon(\"fas fa-house\")}}\n{{font_awesome.render_stacked_icons(\"fas fa-square\", \"fas fa-house\")}}\n```\n\n... or via the [Jinja macros](https://jinja.palletsprojects.com/en/latest/templates/#macros) of the same names:\n\n```\n{% from 'font_awesome.html' import render_icon, render_stacked_icons %}\n{{ render_icon('fas fa-house') }}\n{{ render_stacked_icons('fas fa-square', 'fasfa-house') }}\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Font-Awesome-Flask is an extension for Flask that adds support for Font Awesome to your web application.",
    "version": "0.1.2",
    "project_urls": {
        "Home": "https://github.com/sgraaf/font-awesome-flask",
        "Issues": "https://github.com/sgraaf/font-awesome-flask/issues",
        "Source code": "https://github.com/sgraaf/font-awesome-flask"
    },
    "split_keywords": [
        "flask",
        "extension",
        "font awesome"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2e0a81fb8c629587ead456516687d18da373fd3629e727aa636daaa5d189f24a",
                "md5": "572ac106880563b995378e45eaa40a63",
                "sha256": "9f604094d37e3a1fa90c7f4d6f436c1c37cc4330baff7b5cada0f8597972c6e1"
            },
            "downloads": -1,
            "filename": "font_awesome_flask-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "572ac106880563b995378e45eaa40a63",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": "~=3.8",
            "size": 557259,
            "upload_time": "2023-09-05T18:36:25",
            "upload_time_iso_8601": "2023-09-05T18:36:25.455118Z",
            "url": "https://files.pythonhosted.org/packages/2e/0a/81fb8c629587ead456516687d18da373fd3629e727aa636daaa5d189f24a/font_awesome_flask-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "79c3e6ee7614ec55f5ec6705633fc59896d053d982a8c58272503029d6b3fa88",
                "md5": "c823742ca783a90f4da4835ef12f7696",
                "sha256": "967aefcfb10e40e2537dc5fe0311e84cd1932ee03d82d2ffbde4418ab8970c43"
            },
            "downloads": -1,
            "filename": "font_awesome_flask-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "c823742ca783a90f4da4835ef12f7696",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.8",
            "size": 562276,
            "upload_time": "2023-09-05T18:36:28",
            "upload_time_iso_8601": "2023-09-05T18:36:28.151076Z",
            "url": "https://files.pythonhosted.org/packages/79/c3/e6ee7614ec55f5ec6705633fc59896d053d982a8c58272503029d6b3fa88/font_awesome_flask-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-05 18:36:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sgraaf",
    "github_project": "font-awesome-flask",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "font-awesome-flask"
}
        
Elapsed time: 0.11106s