#32383: ManifestStaticFilesStorage doesn't update JavaScript source map 
references
-------------------------------------+-------------------------------------
     Reporter:  Adam Johnson         |                    Owner:  Adam
                                     |  Johnson
         Type:  New feature          |                   Status:  assigned
    Component:  contrib.staticfiles  |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Adam Johnson):

 * owner:  (none) => Adam Johnson
 * status:  new => assigned


Old description:

> ManifestStaticFilesStorage replaces URL's in CSS files with the hashed
> equivalents, but doesn't have any other out-of-the-box rules. One common
> use case for cross-static-file-references is a
> [https://developer.mozilla.org/en-
> US/docs/Tools/Debugger/How_to/Use_a_source_map JavaScript source map], a
> structured comment in a JS file.
>
> I think it would be a reasonable inclusion that Django modifies these
> too. I got it working (with Whitenoise's subclass of
> `ManifestStaticFilesStorage`) with this extra regex pattern:
>
> {{{
> from whitenoise.storage import CompressedManifestStaticFilesStorage
>

> class SuperStaticFilesStorage(CompressedManifestStaticFilesStorage):
>     patterns = CompressedManifestStaticFilesStorage.patterns + (
>         (
>             "*.js",
>             (
>                 (
>                     r"(//# sourceMappingURL=(.*?\.js\.map))$",
>                     "//# sourceMappingURL=%s",
>                 ),
>             ),
>         ),
>     )
>
> }}}
>
> Ideally the regex would start with a ^", which requires the regex
> mulitline flag, and would NOT be compiled in case-insenstive mode. The
> current storage implementation forces compiling regexes with only the
> case insensitive flag.

New description:

 ManifestStaticFilesStorage replaces URL's in CSS files with the hashed
 equivalents, but doesn't have any other out-of-the-box rules. One common
 use case for cross-static-file-references is a
 [https://developer.mozilla.org/en-
 US/docs/Tools/Debugger/How_to/Use_a_source_map JavaScript source map], a
 structured comment in a JS file.

 I think it would be a reasonable inclusion that Django modifies these too.
 I got it working (with Whitenoise's subclass of
 `ManifestStaticFilesStorage`) with this extra regex pattern:

 {{{
 from whitenoise.storage import CompressedManifestStaticFilesStorage


 class SuperStaticFilesStorage(CompressedManifestStaticFilesStorage):
     patterns = CompressedManifestStaticFilesStorage.patterns + (
         (
             "*.js",
             (
                 (
                     r"(//# sourceMappingURL=(.*?\.js\.map))$",
                     "//# sourceMappingURL=%s",
                 ),
             ),
         ),
     )

 }}}

 Ideally the regex would start with a `^`, which requires the regex
 mulitline flag, and would NOT be compiled in case-insenstive mode. The
 current storage implementation forces compiling regexes with only the case
 insensitive flag.

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32383#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.518178f60f150f8547efacdad209115f%40djangoproject.com.

Reply via email to