Skip to content

Support css url(/static/img/stuff.png) #35

@cepm-nate

Description

@cepm-nate

In a recent project, I had a CSS rule (In the <style> section of a .vue file) that used background-image: url(/static/image.png).

This worked fine in DEV mode, but building and deploying to android (or double-clicking the www/index.html file) resulted in the image resolving to a 404.
Changing the css rule on-the-fly to remove the leading slash (url(static/image.png) made the image load. But removing the slash in the SOURCE make the build fail (MiniCssExtractPlugin threw "unable to resolve" errors).

My workaround is to REMOVE that rule from the <style> section of the file and inject it dynamically in mounted() as url(static/image.png). Thankfully I only have one background image I'm setting this way.

I'm reporting this here, as I think people using this template would expect url() to work with /static/ resources in their <style> section.

Thanks for all your hard work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions