我使用Django Pipeline作为静态文件的插件。
我想要发生的是,当我运行collectstatic时,django-pipeline将缩小文件,并在输出文件夹中以相同的文件名输出它。例如:
static_input/myfile.js #50kb -> collectstatic -> static_output/myfile.js #25kb浏览文档,似乎只能将多个文件输出到一个文件中。
PIPELINE = {
'PIPELINE_ENABLED': True,
'JAVASCRIPT': {
'stats': {
'source_filenames': (
'js/jquery.js',
'js/d3.js',
'js/collections/*.js',
'js/application.js',
),
'output_filename': 'js/stats.js',
}
}
}有没有一种方法可以让django-pipeline简单地缩小我的静态文件而不尝试合并和重命名它们?
发布于 2020-11-20 23:57:52
output_filename是django-pipeline中的一个必需参数,它强烈地表明您不走运。https://django-pipeline.readthedocs.io/en/latest/configuration.html
当前可用的压缩器都没有指定避免合并文件的方法。https://django-pipeline.readthedocs.io/en/latest/compressors.html
您可以编写自己的压缩器,但这可能太麻烦了。
https://stackoverflow.com/questions/64932424
复制相似问题