Skip to main content

Bootstrap Icons as Django templates for embedded SVGs

Project description

django-bs-icon-templates

Django templates for Bootstrap Icons, which allows you to include them directly into other templates. Each SVG is pre-processed to make height a template variable that defaults to 16.

Installation

pip install django-bs-icon-templates

Add to INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    "bs_icon_templates",
]

Usage

Use {% include %} directly in a template:

{% include "bs_icon/alarm.svg" with height=24 %}

Or as a template tag:

{% load bs_icons %}

{% bs_icon "alarm" %}
{% bs_icon "alarm" height=24 %}

As a development dependency

The preprocessed icons are about 8mb in file size. If you only need a few icons, you can install django-bs-icon-templates as a dev dependency and copy icons into the template directory of your choice:

python manage.py copy_bs_icons alarm gear github

Icon names may be given with or without the .svg suffix.

Once the bs_icon_templates is removed from INSTALLED_APPS, remember that only the include method above will work for your vendored icons.

Options:

Flag Default Description
--output-dir BASE_DIR/templates/bs_icon Destination directory
--source-dir package templates dir Source directory

Happy hacking,

aodin

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

django_bs_icon_templates-1.0.0.tar.gz (282.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_bs_icon_templates-1.0.0-py3-none-any.whl (1.2 MB view details)

Uploaded Python 3

File details

Details for the file django_bs_icon_templates-1.0.0.tar.gz.

File metadata

  • Download URL: django_bs_icon_templates-1.0.0.tar.gz
  • Upload date:
  • Size: 282.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for django_bs_icon_templates-1.0.0.tar.gz
Algorithm Hash digest
SHA256 61d63fc2ad81eba3f8b57e213e5fe6ff9185023db6f314c16485a6d1b984f80a
MD5 ca8b03008601f28366715086072d309f
BLAKE2b-256 bc468e1d4bf105267e8f27b20973fb6bd765b51b594dd9d79356c289b2635121

See more details on using hashes here.

File details

Details for the file django_bs_icon_templates-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_bs_icon_templates-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5252265c978d06ebff9a7afe052fca7ba5225dd2cd5298e953f7f579aaa0db28
MD5 742850b19f61b34b61f49f7e23d6fc0e
BLAKE2b-256 b892d3176399ce0228e5c502a58acfd0e9e72afd78e4a69c1a3f5057f4594120

See more details on using hashes here.

Supported by

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