I recently found I needed to create a command to include specific files for 
collectstatic and ignore everything else (images and fonts). The opposite 
of the current --ignore functionality.

I've tried to do this with the current --ignore option using glob syntax 
but haven't managed to "ignore all but these file types".

I'm making this functionality now for my project but wondering if it would 
be a welcome addition to django itself?

Looking through the collectstatic code it should be doable by adding 
another if statement at 
https://github.com/django/django/blob/master/django/contrib/staticfiles/utils.py#L26

if include_patterns and not matches_patterns(fn, include_patterns):
    continue

And some upstream changes to include "include_patterns" as an option for 
the file finders list methods and the collectstatic command itself.

Setting include_patterns to a default of None should make the addition 
backwards compatible for any third party finders.

Is there any interest in doing this? I accept my current use case is fairly 
niche but it may be useful for others.

Nick.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/e0575126-d804-441c-b70a-945d5ffed189%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to