-
Notifications
You must be signed in to change notification settings - Fork 72
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
SVG file not found #110
Comments
For what it's worth, my icons are at |
We're actually seeing a similar issue, but with the <%= inline_svg_tag 'logo.svg' %> which renders: <svg><!-- SVG file not found: 'logo.svg' --></svg> What's confusing is this problem only happens sometimes, and I cannot figure out why. Our application uses both For example, when This might explain why (sometimes) |
@george-norris-salesforce can you give v1.7.0 a try to see if that fixes the problem? |
I am experiencing this too with an upgrade to 1.7.0 Rails 5.1.7 The assets are on the staging server with a hash/thumbprint suffix. So UPDATE (3/14/21) Is there a reason to not just store the svg in an |
I'm on rails 6 and seem to be having the same issue w/ sprockets and webpacker.. I'm using inline_svg v1.7.1 |
I was having the same issue when trying to render a file from webpacker on dev mode. The error was that in dev mode a Tempfile is created with the contents of the real file (wich is fetched from the dev server via http), and Tempfiles try to find a file instead of creating one when there are slashes on its name. I've submitted a PR with a fix. |
Changing the url to include namespace
Image is in Result:
If I change the URL to something wrong.
//fooooobar does not exist Result:
|
I am desperately trying all variants to load an svg inline since at least an hour and nothing works. Always I think the documentation needs a few examples where images should be and how to load them with those paths. I am using webpacker 6 so I started with the SVGs in packs/images/abc.svg and loading them using:
Then I tried switching to the sprockets function and moving the SVGs to app/assets/svg/abc.svg
Then I tried it according to |
I am sure it also didn't work using |
Glad it's working for you now. 👍
Great idea! ✨ Please feel free to open a PR against the README if you have any suggestions for how to improve the documentation with examples. 🙏 |
Yes that would be a good idea. I would suggest examples in form of a table showing "if svg is located in directory xyz you can load it with inline_svg_tag 'abc', but unfortunately it can't find the svgs anymore after deploying to the staging server. |
@arusa sorry to hear you're still having trouble. By default there are two ways that this gem finds your files: WebpackIf you're using Webpacker, the file lookup varies between development and production mode:
inline_svg/lib/inline_svg/webpack_asset_finder.rb Lines 13 to 19 in 17ae73a
Non-WebpackIf you're not using Webpacker, the file lookup uses the asset pipeline to fetch either the precompiled asset (often configured in production environments) or falls back to a static path based on your inline_svg/lib/inline_svg/static_asset_finder.rb Lines 18 to 26 in 17ae73a
I think the next step in debugging this in your production application is to figure out the value of the following configuration options:
Hopefully this will help you to figure out why the gem can't find your SVG files. |
Using
= inline_svg_pack_tag 'javascript/components/images/calc-logo-square.svg'
getting a
SVG file not found
Using Webpacker, latest Rails
SVG is under
client/javascript/components/images/calc-logo-square.svg
The text was updated successfully, but these errors were encountered: