Skip to main content

A Django app to deploy wefonts from Icomoon and display them

Project description

A Django app to deploy downloaded wefonts from Icomoon and display them in a gallery.

Requires

Install

First install the package

pip install django-icomoon

Add it to your installed Django apps in settings :

INSTALLED_APPS = (
    ...
    'icomoon',
    ...
)

Import default app settings:

from icomoon.settings import *

Default behavior require users to be authenticated to view the gallery, if you want to open it for anonymous define the following setting:

ICOMOON_PRIVATE = False

Webfonts and manifests

Now you must define at least one webfont in your project settings like this:

ICOMOON_MANIFEST_FILEPATH = {
    'Default': {
        'fontdir_path': '/home/work/myproject/webapp_statics/fonts/default',
        'csspart_path': '/home/work/myproject/webapp_statics/css/icomoon_icons.scss'
    },
}

Each website entry is a dict containing the following values:

fontdir_path

(Required) Absolute path to the webfont directory.

csspart_path

(Optional) Absolute path where will be written the css part containing webfont icons.

Urls

Just mount its urls in your main urls.py :

urlpatterns = patterns('',
    ...
    (r'^icomoon/', include('icomoon.urls', namespace='icomoon')),
    ...
)

Templates

This at your responsability to load the webfont into your website templates, this app won’t do it for you.

Note that shipped templates in templates/icomoon/ are written using Foundation5 components and inherits from a templates/skeleton.html that you have to create yourself. You better gives an eye to this app templates to correctly integrate them into your project.

Usage

Deployment

Put the downloaded ZIP archive on your server then simply use the command line:

./manage.py icomoon_deploy Default icomoon.zip

The first argument is the webfont key name (defined in your settings, see Webfonts and manifests) to use and the second argument is the path to your downloaded archive to deploy:

./manage.py icomoon_deploy [Webfont name] [Zip archive path]

Default values for these two arguments are respectively Default and icomoon.zip, so if they match your webfont settings, you don’t need to give them:

./manage.py icomoon_deploy

The tool will validate the archive content structure then if all requirements are meets (a JSON manifest and at least one supported font format) it will deploy the archive content to defined path (fontdir_path) in webfont settings.

Optionaly, if a path (csspart_path) is defined for, the manifest will be used to build a css file where all icon selectors are defined, so you can import it to directly use your icons.

Finally the manifest is installed in the same directory than font files.

History

Version 0.4.0 - 2016/04/06

  • Dropped support for Django <= 1.7;

  • Fixed command line arguments for Django == 1.8;

Version 0.3.1 - 2015/10/24

  • Lowering down minimal ‘django-braces’ dependancy, better classifiers for Django versions in setup.py;

Version 0.3.0 - 2015/10/11

  • Implemented command line to deploy webfont from download ZIP on Icomoon, contains many backward incompatible settings, this is related to issue #2;

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-icomoon-0.4.0.tar.gz (10.1 kB view details)

Uploaded Source

File details

Details for the file django-icomoon-0.4.0.tar.gz.

File metadata

File hashes

Hashes for django-icomoon-0.4.0.tar.gz
Algorithm Hash digest
SHA256 992699ad4e25f75fcffbceb145ff825c7ffd5e5acbca445a08c0be8c92cb8e18
MD5 cc7bb0e49e44f4a7f39896eb7d21fc70
BLAKE2b-256 73ebdc3bc4170f10c4a3b8ce5faa492df34226ae6fa62b49f948ae90fe61dbed

See more details on using hashes here.

Provenance

Supported by

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