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

background url(./barbar.png) doesn't work #61

Open
burgalon opened this issue Jun 21, 2016 · 6 comments
Open

background url(./barbar.png) doesn't work #61

burgalon opened this issue Jun 21, 2016 · 6 comments

Comments

@burgalon
Copy link

When using background image in CSS, e.g:

.home {
    text-align: center;
    background: url('./barbar.png')
}

the compiled CSS seems to resolve the asset fine, however the browser is trying to load it relatively to the blob:// css file which was injected to the HEAD causing an incorrect host name by Chrome

@altaywtf
Copy link
Contributor

Hello @burgalon, since we have postcss-assets plugin, I suggest you to load images to your styles by using its functionalities.

background: inline('./barbar.png');

@burgalon
Copy link
Author

Hey @altayaydemir Inlining an image requires them to be base64 encoded into the CSS which isn't very efficient for big images.
postcss-assets allows also to resolve regular images and rewrite the path, however this does not seem to work well together with the current stack, possible because of the helmet head changes and the fact that the CSS is loaded through blob://http....

@basicsharp
Copy link

It seems that this problem occurs when we enable the sourceMap option on css-loader.

There are opening PRs for solving this issue in webpack/style-loader repo:

@OR13
Copy link

OR13 commented Jul 3, 2017

Is this issue still a thing?

if so, can we get clear steps to reproduce?

@bherila
Copy link
Contributor

bherila commented Jul 3, 2017

Yep, I had the same issues with fonts. It was resolved by disabling the sourceMap option as @basicsharp described above.

@bherila
Copy link
Contributor

bherila commented Jul 3, 2017

So I guess this and #142 are dupes.

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

No branches or pull requests

5 participants