rykener / django-manifest-loader

Simplifies webpack configuration with Django
https://django-manifest-loader.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
104 stars 12 forks source link
angular assets cache-busting django django-manifest-loader django-webpack-loader hacktoberfest javascript loader manifest python react split-chunks static templatetag vue webpack webpack-configuration

Django Manifest Loader

Build Status Build Status contributions welcome

Reads a manifest file to import your assets into a Django template. Find the URL for a single asset or the URLs for multiple assets by using pattern matching against the file names. Path resolution handled using Django's built-in staticfiles app. Minimal configuraton, cache-busting, split chunks.

Documentation

About

Turns this

{% load manifest %}
<script src="https://github.com/rykener/django-manifest-loader/raw/dev/{% manifest 'main.js' %}"></script>

Into this

<script src="https://github.com/rykener/django-manifest-loader/raw/dev/static/main.8f7705adfa281590b8dd.js"></script>

Quick reference:

Manifest tag

{% load manifest %}

<script src="https://github.com/rykener/django-manifest-loader/raw/dev/{% manifest 'main.js' %}"></script>

turns into

<script src="https://github.com/rykener/django-manifest-loader/raw/dev/static/main.8f7705adfa281590b8dd.js"></script>

Manifest match tag

{% load manifest %}

{% manifest_match '*.js' '<script src="https://github.com/rykener/django-manifest-loader/raw/dev/{match}"></script>' %}

turns into

<script src="https://github.com/rykener/django-manifest-loader/raw/dev/static/vendors~main.3ad032adfa281590f2a21.js"></script>
<script src="https://github.com/rykener/django-manifest-loader/raw/dev/static/main.8f7705adfa281590b8dd.js"></script>

License

Django Manifest Loader is distributed under the 3-clause BSD license. This is an open source license granting broad permissions to modify and redistribute the software.