-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use staticfiles.storage to generate URLs #52
Conversation
This change should let people use the One suggestion: I'd change line 59 of this PR to: DJANGO_VITE_STATIC_ROOT / staticfiles_storage.stored_name("manifest.json"), as a sensible default. |
Sadly However, even in that case a large amount of code, likely the majority, will still be contained in main.js and this patch would still give a speedup to the compressed |
django 4.2 will add support for processing import statements in javascript files when using ManifestStaticFilesStorage.
|
@blighj this looks very promising to me! Could you rebase your PR? Then I'll take a look in the next few days and try to merge this PR. |
For Vite production mode it seems like it would be useful to use django staticfiles.storage.staticfiles_storage.url method, if staticfiles is installed, similar to how Django's own static template tag works. https://github.com/django/django/blob/0dd29209091280ccf34e07c9468746c396b7778e/django/templatetags/static.py
@thijskramer After a bit of messing, I've rebased that now. |
I'm facing the same problem. I'm using s3 as static file storage and the URLs are not resolved correctly for dynamic imports. I guess this PR solves the problem. |
Is there a planned next release to include this? |
I’ll try to make a release within the next few days.
…On Wed, 24 May 2023 at 19:37, Andrew Graham ***@***.***> wrote:
Is there a planned next release to include this?
—
Reply to this email directly, view it on GitHub
<#52 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJXH4ZXALXP5COHH26VH7DXHZBN5ANCNFSM563GNUPA>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
Btw. this will no longer work: Line 224 in 2b5f899
|
For Vite production mode it seems like it would be useful to use django staticfiles.storage.staticfiles_storage.url method, if staticfiles is installed,
similar to how Django's own static template tag works. https://github.com/django/django/blob/0dd29209091280ccf34e07c9468746c396b7778e/django/templatetags/static.py