Skip to content

Warn instead of error for missing sourcemap files during collectstatic #173

Description

@blighj

Code of Conduct

  • I agree to follow Django's Code of Conduct

Feature Description

When post_processing js/css files during collectstatic with ManifestStatifilesStorage it should warn about missing sourcemap files instead of raising an error and preventing and further processing of files.

Problem

It can happen that you install a third party lib, and only include the main js/css file in your static directory. The file points to a sourcemap file, but you haven't downloaded it, as it's not something you are overly concerned about, especially if you are a beginner. But when you run collectstatic you end up with a confusing error (that we have tried to improve recently). It would be better to give a warning and let the rest of the collectstatic work.

This also affects third party django apps, after doing an audit of djangopackages I found several that include /static folders with files referencing missing sourcemaps. So a developer who wants to use their project and ManifestStatifilesStorage has to know how to use the the --ignore option of colelctstatic, or how to add a /static path to the sourcemap mimicing the static structure of the third party app, as they have no way other than a bug report to change the actual js/css.

Request or proposal

proposal

Additional Details

There is a similar problem with local build js files in your /static folder when using the support_js_module_import_aggregation option. A warning approach could be used when encountering those import * from "./jquery" during collectstatic.

I still think it makes sense to raise the error for missing images, font files, actual css/js imports, etc. As in those cases their is a high probability chance that your project's frontend won't work without the assets and it's good to be told straight away.

Implementation Suggestions

There is prior art implementation in https://github.com/blighj/django-manifeststaticfiles-enhanced/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Idea

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions