Skip to content

Accessing public images from CSS file in production cordova build. #60

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

Closed
mattyforth opened this issue Apr 15, 2019 · 1 comment
Closed

Comments

@mattyforth
Copy link

I'm having trouble getting my image paths to work within my CSS files when building my cordova app for production. I have this image path, that compiles correctly through webpack, however because it has a slash at the beginning of the path, my cordova app cannot find the image correctly, as it can't have a trailing slash at the start of the path.

background-image: url('/img/backgrounds/spots/lime.jpg');

I have set publicPath within my vue.config.js: publicPath: ''

Once running on the phone it tries to reference this image:

background-image: url(/img/backgrounds/spots/navy.jpg)

However it requires it to be this filepath:

background-image: url(img/backgrounds/spots/navy.jpg)

How can I make sure that within my cordova production build I don't have the slash at the start of the path. I also cannot remove the slash out of the path within the CSS file, because then webpack will fail to compile all-together.

Hope that makes sense, thanks in advance.

@m0dch3n
Copy link
Owner

m0dch3n commented Apr 15, 2019

this is more a webpack configuration issue, than an issue which needs to be resolved within the plugin...

I did not read this, but I think it's maybe solving your problem

webpack-contrib/file-loader#46

and maybe

webpack-contrib/file-loader#46 (comment)

If not, search on google for webpack relative paths images

Anyway, I'm closing this issue, as it's not related to the plugin...

@m0dch3n m0dch3n closed this as completed Apr 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants