[Django]-Have django-compressor leave <script type="module"> alone in non-production

3๐Ÿ‘

โœ…

As stated in the official docs:

When COMPRESS_ENABLED is False the input will be rendered without any compression except for code with a mimetype matching one listed in the COMPRESS_PRECOMPILERS setting

What can be done is creating a different COMPRESS_PRECOMPILERS setting for development.

E.g.:

DEBUG = not os.environ.get('DJANGO_PRODUCTION')

if not DEBUG:
    COMPRESS_PRECOMPILERS = (
        ('module', 'browserify {infile} -t babelify --outfile {outfile}'),
    )
๐Ÿ‘คniko

Leave a comment