Skip to content

Allow webpack_static template tag to reference remote files #110

Closed
@saily

Description

@saily

Hi,

i was playing around with django-storages and django-minio-storage to upload static files to aws s3 or minio s3 storage.

After a while i noticed this works fine except for my static ressources included with webpack-loader template tags as render_bundle or webpack_static. I digged into the code and round the fallback on STATIC_URL in templatetags/webpack_loader.py which was already refactored on current master, but still has the same issue

@register.simple_tag
def webpack_static(asset_name, config='DEFAULT'):
    return "{0}{1}".format(
        get_loader(config).get_assets().get(
            'publicPath', getattr(settings, 'STATIC_URL')
        ),
        asset_name
    )

When publicPath is set in stats file it's not possible to load it from remote, see #107. It might be a solution in #102 and use default static template tags, but basically this package should work with storage backends as:

  • minio_storage.storage.MinioStaticStorage
  • storages.backends.s3boto3.S3Boto3Storage
  • django.contrib.staticfiles.storage.ManifestStaticFilesStorage
  • whitenoise.storage.CompressedManifestStaticFilesStorage

I'd love to start a discussion here and make this package work with different storage backends and also consider people using whitenoise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions