Skip to main content

Django Minifier

Minify Django Template.

Install:

pip install django_minifier

Add template loader

# settings.py
TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [
            BASE_DIR / "example" / "templates"
        ],
        # "APP_DIRS": True, 
        "OPTIONS": {
            "context_processors": [
                ...
            ],
            "loaders": [
                (
                    "django.template.loaders.cached.Loader",
                    [
                        "django_minifier.app_directories.Loader",
                        "django_minifier.filesystem.Loader",
                        "django_minifier.themes.Loader",
                    ],
                )
            ],
        },
    },
]

TEMPLATE_MINIFIER = not DEBUG
TEMPLATE_MINIFIER_EXCLUDED_DIRS = ("admin/", "wagtailadmin/")
TEMPLATE_MINIFIER_FILENAME_EXTENSIONS = (".html", ".htm")
TEMPLATE_MINIFIER_STRIP_FUNCTION = False

Metadata

Release files for django-minifier 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-minifier 0.0.1
File Size Uploaded
django_minifier-0.0.1.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-minifier 0.0.1
File Interpreter ABI Platform
django_minifier-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.2 kB

Release files / django_minifier-0.0.1.tar.gz

Download URL django_minifier-0.0.1.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1ca1187f378f6744f64204b8160588ef4727679e73a765502af7149975ea36cd
BLAKE2b-256 checksum
How to use checksums
91d7f6f1acd08bbd70af32dc32506c774422c5911b92be09cabc51ef5f6e74c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Release files / django_minifier-0.0.1-py3-none-any.whl

Download URL django_minifier-0.0.1-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5db2bc0ad81eff641181dfddc7b4aeb68dee8f602fa9b857e02a582d179a4d12
BLAKE2b-256 checksum
How to use checksums
f2c5c3eb50adf5bebea8b076b31a1b93d9f822cb54e0b3de6ec48709bd9fde23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page