automatically remove source files after collectstatic with django-pipeline -
with django-pipeline, possible automatically remove source files after collectstatic ?
for example :
pipeline_js = { 'stats': { 'source_filenames': ( 'js/jquery.js', 'js/d3.js', 'js/application.js', ), 'output_filename': 'js/stats.js', } }
collectstatic :
$ python manage.py collectstatic $ ls static/js jquery.js d3.js application.js stats.js
(i don't want jquery.js, d3.js, application.js)
django-pipeline sends signals whenever compiles package, can read more in docs, , signals in general here. can hook signal this:
from pipeline.signals import js_compressed def clear_files(sender, **kwargs): print kwargs if 'package' in kwargs: print kwargs['package'].sources # here remove unwanted files js_compressed.connect(clear_files)
Comments
Post a Comment