django-flexible-manifest-staticfiles
This extension to django.contrib.staticfiles.storage.ManifestStaticFilesStorage allows you to specify a list of file patterns that should be ignored/excluded from being versioned and added to the manifest. You can also specify it the other way around and say which files should be included.
This allows you to add versioned naming to only static files of your choosing. For example, you may want CSS and JS files to be versioned, but not fonts, images or other assets.
I've written and tested this against Django 2.2. Your mileage elsewhere may vary!
Installation
Use pip:
pip install django-flexible-manifest-staticfiles
Setup
Set in your settings.py:
STATICFILES_STORAGE = 'django_flexible_manifest_staticfiles.storages.ForgivingManifestStaticFilesStorage'
Usage
Set in your settings.py you can set two settings:
STATICFILES_VERSIONED_INCLUDE- This is a list of patterns you want to be included. Only files that match at least one of these patterns will be included. If you omit this setting, then all files are included by default.STATICFILES_VERSIONED_EXCLUDE- Any file matching any of these patterns will be excluded from being versioned.
Files must match against both rules (e.g. they must be both in the include list and not in the exclude list) in order to be versioned.
Note that the complete path relative to the static directory is available for matching against.
Examples
This would only version .css and .js files, but would exclude minified files:
STATICFILES_VERSIONED_INCLUDE = ['.css$', '.js$']
STATICFILES_VERSIONED_EXCLUDE = ['min.css$', 'min.js$']
This would version all files asides from .jpg files:
STATICFILES_VERSIONED_EXCLUDE = ['.jpg$']
This would only version things in your /static/scripts:
STATICFILES_VERSIONED_INCLUDE = ['scripts/.*$']
Metadata
Release files for django-flexible-manifest-staticfiles 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-flexible-manifest-staticfiles-1.0.2.tar.gz | 6.4 kB | Without provenance | Details for django-flexible-manifest-staticfiles-1.0.2.tar.gz |
Release files / django-flexible-manifest-staticfiles-1.0.2.tar.gz
| Download URL | django-flexible-manifest-staticfiles-1.0.2.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
04e92215239f48de37b99623e2280f27b050d4625d557d8f85d2aebece672333
|
|
BLAKE2b-256 checksum How to use checksums |
a2c9d4b697ccdfd1169afd752ad4016eab86b0978481bb1a4dc52c18c93914b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/44.1.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/2.7.15
|
Security for django-flexible-manifest-staticfiles 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.