django-pipeline
django-pipeline copied to clipboard
PIPELINE_ENABLED = False produces duplicate output scripts with multiple collectstatic invocations
I've been fighting issue when multiple running of collectstatic produces duplicated scripts when DEBUG=True (or PIPELINE_ENABLED=False)
django-pipeline==1.6.0
STATIC_URL = '/static/'
STATIC_ROOT = '/tmp/pipeline-bug-static/'
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'pipeline.finders.PipelineFinder',
)
PIPELINE = {
'PIPELINE_ENABLED': False,
'JAVASCRIPT': {
'foo': {
'source_filenames': (
'coffee/*.coffee',
),
'output_filename': 'js/foo.js',
}
},
'COMPILERS': [
'pipeline.compilers.coffee.CoffeeScriptCompiler',
]
}
My project layout:
$ tree
.
├── bugapp
│ ├── admin.py
│ ├── apps.py
│ ├── __init__.py
│ ├── migrations
│ │ └── __init__.py
│ ├── models.py
│ ├── __pycache__
│ ├── static
│ │ └── coffee
│ │ └── 01.coffee
│ ├── tests.py
│ └── views.py
├── bugproject
│ ├── __init__.py
│ ├── __pycache__
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
└── manage.py
first invocation
$ ./manage.py collectstatic --noinput
Copying '/home/nexus/tmp/pipeline-bug/bugapp/static/coffee/01.coffee'
Post-processed 'js/foo.js' as 'js/foo.js'
Post-processed 'coffee/01.coffee' as 'coffee/01.ab3e0608360a.coffee'
Post-processed 'js/foo.js' as 'js/foo.7251e26889cf.js'
1 static file copied to '/tmp/pipeline-bug-static', 3 post-processed.
and output
$ tree /tmp/pipeline-bug-static
/tmp/pipeline-bug-static
├── coffee
│ ├── 01.ab3e0608360a.coffee
│ ├── 01.coffee
│ └── 01.js
└── js
├── foo.js
└── foo.7251e26889cf.js
2 directories, 5 files
cat /tmp/pipeline-bug-static/js/foo.js
(function(){(function(){var e;e=function(){return console.log("foo")}}).call(this)}).call(this);
and after second invocation:
$ ./manage.py collectstatic --noinput
Post-processed 'js/foo.js' as 'js/foo.js'
Post-processed 'js/foo.js' as 'js/foo.1992317bf4ea.js'
0 static files copied to '/tmp/pipeline-bug-static', 1 unmodified, 2 post-processed.
and output:
$ tree /tmp/pipeline-bug-static
/tmp/pipeline-bug-static
├── coffee
│ ├── 01.ab3e0608360a.coffee
│ ├── 01.ab3e0608360a.js
│ ├── 01.coffee
│ └── 01.js
└── js
├── foo.js
├── foo.1992317bf4ea.js
└── foo.7251e26889cf.js
cat /tmp/pipeline-bug-static/js/foo.js
(function(){(function(){var e;e=function(){return console.log("foo")}}).call(this),function(){var e;e=function(){return console.log("foo")}}.call(this)}).call(this);
It looks like second invocation is confused with glob and concatenates cached and non-cached files together - so the doubled output.
It seems similar to my issue - https://github.com/jazzband/django-pipeline/issues/507
this is not a issue, when you change a modifiy a file this change the hash for it and that's why the previous file is maintained, but this dont matter because cachedstorage only call the last new cached version of your file
There was NO change in a file plus there is no reason why change would produce duplicated contents of minified output
did u resolve this issue ?