Font-Awesome-Flask


NameFont-Awesome-Flask JSON
Version 0.1.5 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_time2024-06-16 16:20:12
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/c2/56/7a703a394b70e36fd2fc82539cff085a1a84652d95d68f711b480de0c3ac/font_awesome_flask-0.1.5.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.5",
    "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": "d6d1d49504bf90e43c0797fa92dfcff267889ab483aff185a5b0f65e5f94bd78",
                "md5": "ac79f237e7797dbbaa434bd4d1ca2e35",
                "sha256": "65d7333ea595bcfa5e2fa688113f3220efb8fe7b5a39412f7ad2a8fa1169b1dd"
            },
            "downloads": -1,
            "filename": "font_awesome_flask-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ac79f237e7797dbbaa434bd4d1ca2e35",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": "~=3.8",
            "size": 561532,
            "upload_time": "2024-06-16T16:20:11",
            "upload_time_iso_8601": "2024-06-16T16:20:11.182252Z",
            "url": "https://files.pythonhosted.org/packages/d6/d1/d49504bf90e43c0797fa92dfcff267889ab483aff185a5b0f65e5f94bd78/font_awesome_flask-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c2567a703a394b70e36fd2fc82539cff085a1a84652d95d68f711b480de0c3ac",
                "md5": "1436a0d4604d68f516d0d49bd7973abb",
                "sha256": "499e1ad6d3f45e825601644d466077e3b687a989a8629b65db5bc76af7a0222a"
            },
            "downloads": -1,
            "filename": "font_awesome_flask-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "1436a0d4604d68f516d0d49bd7973abb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.8",
            "size": 572089,
            "upload_time": "2024-06-16T16:20:12",
            "upload_time_iso_8601": "2024-06-16T16:20:12.837158Z",
            "url": "https://files.pythonhosted.org/packages/c2/56/7a703a394b70e36fd2fc82539cff085a1a84652d95d68f711b480de0c3ac/font_awesome_flask-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-16 16:20:12",
    "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.31822s