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

Failing to load SVG's #2

Closed
ghost opened this issue Nov 9, 2017 · 2 comments
Closed

Failing to load SVG's #2

ghost opened this issue Nov 9, 2017 · 2 comments

Comments

@ghost
Copy link

ghost commented Nov 9, 2017

Fails to load in SVG's for me.
I've added the following into webpack.config.helper.js in the rules section.

{
      test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
      loader: 'url-loader'
}

And getting You may need an appropriate loader to handle this file type. on all the SVG types. Any suggestions?

@moklick
Copy link
Contributor

moklick commented Nov 9, 2017

Try to use raw-loader for loading SVG's webpack-contrib/url-loader#6

@moklick moklick closed this as completed Nov 9, 2017
@alonronin
Copy link

alonronin commented Nov 30, 2017

you can use url-loader to use with <img /> tags at html and css background-image rule.

import svg from './file.svg';

const img = `<img src="${svg}" />`;

document.body.innerHTML = img;
div {
  width: 100px;
  height: auto;
  background-img: url(./file.svg) no-repeat center;
}

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