Bigbob556677
Bigbob556677

Reputation: 2158

Minify All Static Files Without Changing Their Names Django-Pipeline

I'm using Django Pipeline as a drop in minifier for my static files.

What I would like to happen is that when I run collectstatic that the django-pipeline would minify the file and output it with the same filename in the output folder. e.g.

static_input/myfile.js #50kb -> collectstatic -> static_output/myfile.js #25kb

Looking through the docs, it only seems possible to output multiple files to one file e.g.

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',
        }
    }
}

Is there a way to make django-pipeline simply minify my static files without trying to merge and rename them?

Upvotes: 1

Views: 827

Answers (1)

Master117
Master117

Reputation: 659

output_filename is a required parameter in the django-pipeline, strongly indicating that you are out of luck. https://django-pipeline.readthedocs.io/en/latest/configuration.html

None of the currently available compressors specify a way to avoid merging of files. https://django-pipeline.readthedocs.io/en/latest/compressors.html

You could write your own compressor, but that is probably too much work.

Upvotes: 0

Related Questions