django-manifeststaticfiles-enhanced: Improving ManifestStaticFilesStorage

I’m hoping to contribute a few small developer experience improvements to django’s ManifestStaticFilesStorage. They could potentially be included somewhere in the django 6 series.

I’ve built a new 3rd party package as a first step, (based on what Carlton keeps saying), django-manifeststaticfiles-enhanced pypi github.

I’d appreciate anyone willing to help, either by trying out the package and giving feedback. Or if any experienced contributor in this area feels like giving a code review, that would be lovely too.

The main improvement is taking Adam’s idea of using a lexer for js/css substitutions, instead of the current regex approach. This solves the classic /* url("missing.css") */ error (ticket_21080). It also provides much more robust support for js import/export statements. These are supported by default rather than opt in.

To offset the performance cost of the lexer, there is now a dependency graph for files that need substitutions, which is more efficient than the current iteration approach. This also means there is no longer a need for max_post_process_passes and circular dependencies can be supported.

On my machine to run collectstatic for djangoproject.com takes 1.6s currently, it takes 1.5s to achieve the same with the new package, and 2s to add in import/export statements.

1 Like