![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
django-compress-staticfiles
Advanced tools
A static files storage backend for compression using GZip and/or Brotli that inherits from Djangos ManifestFilesMixin and StaticFilesStorage; also minifies static files.
A Django static files storage backend inheriting from ManifestFilesMixin and StaticFilesStorage. Compresses, using GZip and/or Brotli, and minifies static files when running the Django collectstatic command.
STATIC_ROOT
directory. If changes were
made to some of your static files; old files will remain there. Use the
--clear
flag when running collectstatic
to delete the entire STATIC_ROOT
and recreate it — check out the Django docs for more info.DEBUG = True
in your Django settings.py file; only the normal file
is used in templates. Templates will only use the hashed and minified
version of the file when DEBUG = False
. This is the behaviour of the Django
staticfiles app in the url
method of the ManifestFilesMixin
..min
file to be copied to STATIC_ROOT; that file will be
compressed but not re-minified. If that .min
file has a corresponding
non-minified counterpart, that non-minified file will be minified and
that minified file is the one that will be used to map regular.css
to
regular.min.{hash}.css
in the manifest file.somefile.css
won't be compressed
to somefile.css.gz
because we will likely never use it.Even though the CompressStaticFilesStorage inherits from StaticFilesStorage, which inherits from FileSystemStorage, the CompressStaticFilesMixin and MinifyFilesMixin can be used with your own storage.
Install the app and it's dependencies using:
pip install git+https://github.com/armandtvz/django-compress-staticfiles.git
Set the STATICFILES_STORAGE setting in your project settings.py as follows:
STATICFILES_STORAGE = 'compress_staticfiles.storage.CompressStaticFilesStorage'
You don't need to set any other settings for everything to work but for some mild customisation see the settings heading for more info.
Run the collectstatic command as you usually would:
python manage.py collectstatic
There's no need to set these settings as they have defaults — they're there
if you want them. All are True
by default.
# All are True by default.
MINIFY_STATIC = True
BROTLI_STATIC_COMPRESSION = True
GZIP_STATIC_COMPRESSION = True
Only files ending with these extensions will be compressed:
The rJSMin Python package is used for JavaScript minification. See rJSMin's Github repo for docs and more information. JS is not obfuscated. Exclamation/bang comments will be retained.
Exclamation/bang comments will be retained.
Though I haven't used django-compressor or django-pipeline myself; I have gone through their respective documentation. I'm sure django-compressor and django-pipeline are excellent tools and I'm sure there's a time and place to be using them.
However, this package aims to be something smaller and simpler with absolutely no configuration needed; no template tags and no extra management commands. It aims to be unobtrusive; to slide straight into the regular Django `collectstatic' management command.
Bundling is so HTTP/1.1. Join us in HTTP/2 where things are multiplexed. :) Jokes aside... If you really need bundling: it's probably best to look at something like Webpack, django-compressor or django-pipeline.
ManifestFilesMixin
?For those who are unfamiliar with the ManifestFilesMixin please read the Django docs for ManifestFilesMixin and ManifestStaticFilesStorage.
This project follows semantic versioning (SemVer).
Check the root of the repo for these files.
FAQs
A static files storage backend for compression using GZip and/or Brotli that inherits from Djangos ManifestFilesMixin and StaticFilesStorage; also minifies static files.
We found that django-compress-staticfiles demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.