Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cepm-nate opened this issue Mar 23, 2019 · 0 comments
Open

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

cepm-nate opened this issue Mar 23, 2019 · 0 comments

Comments

@cepm-nate
Copy link

cepm-nate commented Mar 23, 2019

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant