Hi everyone Just starting to build on
# avo-2
b
Hi everyone! Just starting to build on Avo 🙂 Ran into an issue that Im not sure if is a known one. I setup as per instructions but am seeing
<svg><!-- SVG file not found: 'resources.svg' --></svg>
in the HTML of the navigation, and this breaks the layout (the 'Resources" span is pushed off the right and overflows the container). I am using
propshaft
with Rails 7,
cssbundling-rails
and
jsbundling-rails
Ah right Im using
inline_svg
gem... must add avo's svg's directory to its search path.
l
hmm, that's weird. it should just work out of the box
are you using the
inline_svg
method or Avo's
svg
method?
the
svg
helper should pick up all the assets
or, the better question would be, can you show me a screenshot of where its failing? Maybe I'm being presumptious about where it's failing
b
So Im using
inline_svg
with asset caching enabled at boot time. This seems to be the issue
by adding the path to Avo's SVGs to the search paths of
InlineSvg::CachedAssetFile
then it works fine
Specifically I am using a filter that will cache any .svg file from those directories, eg
Copy code
InlineSvg.configure do |config|
  spec = Gem::Specification.find_by_name("avo")
  gem_root = spec.gem_dir
  config.asset_file = InlineSvg::CachedAssetFile.new(
    paths: [
      "#{Rails.root}/app/assets/images/svgs/",
      gem_root + "/app/assets/svgs/"
    ],
    filters: /\.svg/
  )
end
b
2 years later, and this came in clutch! 🙏🏻 ❤️ TY @boundless-printer-62821
@lemon-wall-20836 I'm wondering if you have any other insight on this We're using sprokets and have our assets coming from a CDN. But when loading AVO, no icons come back. I checked
::Rails.application.assets_manifest
(
svg_finder.rb
), but there's nothing there I'm just trying to get a better idea on how the loading actually works, and why they're not found
They're not compiled in vite asset manifest either and not found in the CDN
config.assets.compile
is false
config.asset_host
is set to our server
@boundless-printer-62821 Did you stick with that solution, or you ended up going with something else?
I saw this issue https://github.com/jamesmartin/inline_svg/issues/127 Which aligns with @boundless-printer-62821 findings, but it makes no sense why an asset CDN not a standard supported
I see Avo has a custom finder, but it's still not loading it from the CDN. Maybe because it doesn't exist there (not being compiled appropriately)
Adding that custom setting for InlineSvg didn't work because we wouldn't include avo-heroicons assets, just avo For example, calling
path = Avo::SvgFinder.find_asset("heroicons/outline/eye-off.svg").pathname
gives me
ruby/3.3.0/gems/avo-heroicons-0.1.1/lib/assets/svgs/heroicons/outline/eye-off.svg
, which wouldn't be included
The weird part is that this only started being a problem recently
Funny story to tell about this A branch was deployed directly to prod/staging, and the other environments weren't updated. So I didn't see that someone overrode the
InlineSvg
asset_file
, causing this problem. It was just a matter of time until this bug hit the other environments. Spent the whole day chasing my own tail. Thanks @boundless-printer-62821 for lending me your thread for this, and sorry @lemon-wall-20836 for making you question if this was an Avo bug ❤️ Everything is good now, we just removed the custom
InlineSvg
configuration, which wasn't even needed in the first place
Ayyy congratulationss, Adrian!! ❤️ 🥳
Oh no, don't apologize! Family always come first
2 Views