Skip to content
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

DEP 84: Rejuvenate form media #84

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

thibaudcolas
Copy link
Sponsor Member

@thibaudcolas thibaudcolas commented Dec 19, 2023

Draft, not ready for review yet

Read the DEP as HTML

For context, see the forum thread: Rejuvenating vs deprecating Form.Media.

Copy link

@matthiask matthiask left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think introducing the JS class from django-js-asset into Django would be worthwile; probably a few parts of the admin should be refactored to take advantage of this? It's very stable, nothing has changed since the beginning of 2022.

Comment on lines +31 to +42
- ES modules
- Import maps
- Dynamic module imports
- async, defer scripts
- CSPs via nonce attributes
- integrity attribute
- fetchpriority attribute
- nomodule attribute
- Arbitrary script attributes
- Preloading / speculative loading
- Resource ordering (see `capo.js <https://rviscomi.github.io/capo.js/>`_)
- Web Components
Copy link

@matthiask matthiask Jun 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's a very complete list. As I already said on the forum thread, I think that the frontend tooling space is still moving so quickly that it's hard to know which tools may or may not be useful in a few years time. When I think about Django and it's stability I have a horizon of several years always, with frontend tooling that's just not the case. If we had more fellows and/or more people which are paid to work on Django it could be a good idea. Even though I'm actually a (p)react and web/rspack fan I think it's a good idea for Django to stay in the backend world.

So, I think there's a lot of value in trying to support CSP (that was one of the motivations for django-js-asset, see https://406.ch/writing/django-admin-apps-and-content-security-policy-compliance/ ), supporting additional arbitrary attributes on <script> tags etc. but that's it.

I'm not sure I understand the resource ordering thing. Django already supports relatively complex dependencies (at least since https://code.djangoproject.com/ticket/30153). Of course that doesn't do anything about the initial page loading performance, but then you're already in the area of bundlers again.

@claudep
Copy link
Member

claudep commented Jun 9, 2024

I think introducing the JS class from django-js-asset into Django would be worthwile; probably a few parts of the admin should be refactored to take advantage of this? It's very stable, nothing has changed since the beginning of 2022.

Big +1. When I pushed for django/django@4c76ffc2d6c77, it was my hope that at some point we could agree on some class-based JS/CSS objects (see the example in test_media.py).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants