Opened 21 months ago

Last modified 21 months ago

#34563 new New feature

ManifestStaticFilesStorage support for CSS module scripts in Javascript files.

Reported by: Michael Owned by: nobody
Component: contrib.staticfiles Version: 4.2
Severity: Normal Keywords: Manifest Static Files Storage, javascript css html module scripts
Cc: Adam Johnson Triage Stage: Someday/Maybe
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no
Pull Requests:How to create a pull request

Description

CSS modules scripts are becomming a thing, see https://web.dev/css-module-scripts/#:~:text=CSS%20module%20scripts%20are%20available,Safari%20is%20not%20yet%20available.

Current we only support JavaScript modules and not CSS modules with the ManifestStaticFilesStorage.

The following import paths in JS files files will need to be converted when collecting static with ManifestStaticFilesStorage:

import sheet from './styles.css' assert { type: 'css' };

Additionally WHATWG is firming up HTML modules, so we could proactively handle this too while we are at it:

import content from './template.html' assert { type: 'html };

According to the ticket's flags, the next step(s) to move this issue forward are:

  • Unknown. The Someday/Maybe triage stage is used to keep track of high-level ideas or long term feature requests.

    It could be an issue that's blocked until a future version of Django (if so, Keywords will contain that version number). It could also be an enhancement request that we might consider adding someday to the framework if an excellent patch is submitted.

    If you're interested in contributing to the issue, raising your ideas on the Django Forum would be a great place to start.

Change History (2)

comment:1 by Mariusz Felisiak, 21 months ago

Cc: Adam Johnson added
Triage Stage: UnreviewedSomeday/Maybe

I think it's too early for this as Firefox and Safari still don't support it, and there doesn't seem to be any ongoing work on supporting it in the last 2 years.

comment:2 by Adam Johnson, 21 months ago

I agree, let’s get multiple browser support before modifying Django. You can implement support in your project or a third party package beforehand.

Note: See TracTickets for help on using tickets.
Back to Top