Skip to main content

Django template minifier

Project description

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

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_minifier-0.0.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

django_minifier-0.0.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file django_minifier-0.0.1.tar.gz.

File metadata

  • Download URL: django_minifier-0.0.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for django_minifier-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1ca1187f378f6744f64204b8160588ef4727679e73a765502af7149975ea36cd
MD5 c3a7d15897f755a9b1be0895045005c2
BLAKE2b-256 91d7f6f1acd08bbd70af32dc32506c774422c5911b92be09cabc51ef5f6e74c6

See more details on using hashes here.

File details

Details for the file django_minifier-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: django_minifier-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for django_minifier-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5db2bc0ad81eff641181dfddc7b4aeb68dee8f602fa9b857e02a582d179a4d12
MD5 d8664fba250e4d97d2776a0ba17231ff
BLAKE2b-256 f2c5c3eb50adf5bebea8b076b31a1b93d9f822cb54e0b3de6ec48709bd9fde23

See more details on using hashes here.

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