-
-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update sourcemap paths when concatenating source files.
When building a package from source files, the built source files get concatenated together before being post-processed by Django. Prior to Django 4.0, the post-processing step would normalize `url(...)` entries in CSS by looking it up in storage and replacing the path with the hashed version. Starting in Django 4.0, post-processing would do the same for sourcemaps. This can break when concatenating either CSS or JavaScript files, since Pipeline may produce a built package file that's in a different directory from one or more built source files. Django would fail to find the file and raise an error. We now include sourcemap normalization as part of the concatenation process. This is using a similar approach to `url(...)` normalization, but now consolidated into the `Compressor.concatenate()` function. This has been updated to take arguments controlling the concatenation process, such as a regex for capturing paths to normalize. The regex for capturing sourcemap lines is built to be spec-compliant, and is currently more broad than what Django looks for during post-processing. This will help avoid potential issues as Django makes changes to their process. The old functions (`concatenate_and_rewrite()`) and old default behavior has been left intact, but with runtime deprecation warnings, so that any code specializing Pipeline will continue to work. This helps ensure this change is API-compatible and non-breaking. See issue #808 for more details on the problem and the solution.
- Loading branch information
Showing
5 changed files
with
508 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.