Open ilovett opened 10 years ago
With the help of @kevin-brown who pointed me using custom Finders... looking at the code I saw ignore_patterns
which looked like exactly what I needed. I ran into problems though using more than 1 finder... perhaps they are overriding each other.
STATICFILES_FINDERS = (
'pipeline.finders.FileSystemFinder',
'pipeline.finders.AppDirectoriesFinder',
)
This setup for example, you can see *.css
is in ignore_patterns
of AppDirectoriesFinder
class AppDirectoriesFinder(PatternFilterMixin, AppDirectoriesFinder):
"""
Like AppDirectoriesFinder, but doesn't return any additional ignored
patterns.
This allows us to concentrate/compress our components without dragging
the raw versions in via collectstatic.
"""
ignore_patterns = [
'*.js',
'*.css',
'*.less',
'*.scss',
]
But '*.css' is not included in ignore_patterns
of FileSystemFinder
....
When I performed collectstatic
, the css files were getting through, but js files werent... *.js
is ignored in both Finders.
So then I decided to make my own custom finder. I assumed I could customize even more here, for example, you might want all js/*.js
ignored, but vendor/*.js
to get through... It would be great if ignore_patterns
supported this -- which could be tied into my proposal in my first post.
+1 -- this would be very nice. I use django-pipeline to compile and compress my app which is written primarily in coffeescript. django-pipeline supports this great, but I end up with *.coffee files on my static file server. I will probably do what @ilovett is suggesting, but it would be nice to just be able to specify glob patterns to avoid pushing these files to the server.
Here's a module that provides more clever pipeline finders: https://gist.github.com/SmileyChris/78d1922789b316ac1c84
Apart from the cached_property
bits, it would be easy to drop this into core code. I'll probably get around to a proper pull request at some time in the distant future if noone else does.
on my side the clever filters won't work.. I still have *.scss files
I'm not sure where this request should go... either with
django-pipeline
ordjango-storages
or even something to do withcollectstatic
It would be great to have an option to abort uploading / copying files which build a compressed asset... Or delete them after they have been post-processed... In my case, I have a compressed js file and would like to only upload the compressed version to production / S3, and not all the other files that were used to build it.
After
collectstatic
all of those files exist instaticfiles
or ons3
... would be cool to have an to remove either all of those or some sort of wildcard path to ignore uploading... For example: