All Projects → mixxorz → django-inline-svg

mixxorz / django-inline-svg

Licence: MIT License
A simple SVG template tag for Django

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to django-inline-svg

django-manifest-loader
Simplifies webpack configuration with Django
Stars: ✭ 105 (+50%)
Mutual labels:  templatetag

django-inline-svg Latest version

Build status Software license

A simple plugin that adds an svg template tag to inline your SVGs in your Django templates.

Update 2019: Don't fear the lack of updates. This library still works. I use it for every project.

Installation

Install it from pypi.

$ pip install django-inline-svg

Add svg to your INSTALLED_APPS.

INSTALLED_APPS = (
    ...
    'svg',
    ...
)

Usage

Store your SVGs in folder named svg at the root of any of your static file directories.

my_app
|-- static
|   |-- svg
|       |-- logo.svg
|       |-- check.svg
|       |-- cross.svg

Use the svg template tag.

{% load svg %}

<h1 class="logo">{% svg 'logo' %}</h1>

You can set SVG_DIRS to control where to look for your svgs.

# settings.py

SVG_DIRS=[
    os.path.join(BASE_DIR, 'my-svgs')
]

Support

The tests are run against Django 1.8 to 2.0 on Python 2.7, 3.4, 3.5, 3.6.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].