Skip to main content

A simple SVG template tag for Django

Project description

Build status Monthly downloads Software license

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

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, 1.9, 1.10 on Python 2.7, 3.3, 3.4, 3.5.

License

MIT

Project details


Download files

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

Files for django-inline-svg, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size django-inline-svg-0.1.1.tar.gz (3.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page