-
Notifications
You must be signed in to change notification settings - Fork 4.4k
background image url is wrong #208
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
Comments
Can you please link to an example repo showing the problem? |
https://github.com/ttquoccuong/webpacktemplatedemo this is repo demo, |
me too. npm run build |
@ttquoccuong @cn-wang -cp('-R', 'static/', assetsPath)
+cp('-R', 'static/', config.build.assetsRoot) for |
I believe this should be working now. @ttquoccuong @cn-wang @UncleBill Can any of you confirm? |
I have the same issue on my Jew Simulator project. In dev mode all ok, but on GitHub Pages (mapped to my grawl.ru domain) all paths is broken because of subfolder format of page URL.
So I changed But not images used in CSS
There is no Here it is: https://github.com/Grawl/jew-simulator/blob/master/src/app.sass#L48 In hope of underhood magic I change background-image: url('/static/images/OdessaModeBackground.jpg') to background-image: url('../static/images/OdessaModeBackground.jpg') And I have another problem:
It's strange how I got |
Someone resolve this guys? I start with: and then i only try loading a div with a background-image as INLINE style with the same url of the example logo.png someone know why? |
I had similar issues, but my fix was quite easy: On line 10 of /config/index.js, I changed the To me, this appears to be a better default value as it won't cause the errors I and others have. |
just modify the publicPath for url-loader like
|
@githoniel this fixes a very obvious bug in this template, where the production CSS file generates incorrect |
I will close this because it's been too long and the template went through a multitude of changes. If such a problem persists, please open a new issue |
thank you so much! i'll check it back with new version. |
What the fuck? "Jew Simulator"? Did nobody see anything incredibly wrong with that? @Grawl what is your deal, bro? |
@launchriot it's called humor and sarcasm. sorry if it's a bad jokes for you. now I have to store t anywhere else. |
@Grawl happy to chat about it if you want. you can email me at [email protected]. |
I guess the error persists since doing what @githoniel suggested solved the problem for me. I hope it gets fixed for everybody by default someday. EDIT: Actually, it worked for the css file because the image is relative to the css's file path. But if I would like to load a image directly, it would then fail. It's two different scenarios: images inside .css (they are relative to the file) and image elsewhere (they are relative to assetsPublicPath. Does anyone have a solution that would work for both cases? |
I'm also having the same issue as @guilhermeaiolfi . if we use However, if we put We could solve this by putting Looks like the publicPath for assets loaded via the style section of a vue component should be different then the publicPath for assets loaded from the template section of a component. More specifically, only the assets from the style section should have ../../ prefixed, not all the assets... edit: our current workaround is to change |
Any workaround/solution that doesn't end up determining where our files go or creating others problems? Changing the I've seen that there are other issues opened that are related: #1021, #1284, #1266. But there isn't a perfect solution yet. Just workaround for specific scenarios. I don't know how more people are not complaining about it. |
Using the method @S4mw1s3 still gives me issues. Right now, I can either have |
@bradbotcode, we are also facing the same issue. Please let us know if you find any solution. |
I add background-image in
App.vue (Ex: ./assets/background.jpg)
or Hello.vue (Ex: ./../assets/background.jpg)
When i run dev, anything is working
but when i build product, background image url in CSS is wrong,
it become /dist/static/css/static/img/bg.2d0dc72.jpg
my image is in "assets/bg.jpg"
so sorry, because my english is not good!
tks
The text was updated successfully, but these errors were encountered: