inline_svg
inline_svg copied to clipboard
Set asset finder from callable
It fixes #151 by allowing the asset finder to be a callable object. This is useful when the asset pipeline is not ready when the initializer is run, for example, when using Propshaft.
I don't know if this is the best way to solve this problem. On the one hand, Propshaft could be done when its initializer is run, but on the other hand, this gem's railtie assumes the asset pipeline is ready.
Hi guys! Just wanted to let you know - right now, the only way it works for me with Propshaft, is if I add this:
# config/initializers/inline_svg.rb
InlineSvg.configure do |config|
config.asset_finder = InlineSvg::PropshaftAssetFinder
end
… right now, the only way it works for me with Propshaft, is if I add this…
@yshmarov So, this branch does not work with your app? Did you change the order in your Gemfile, as mentioned in #151?
I have a Propshaft app working with this change. Still, I'm unconvinced by the initializer approach and would rather have a set of strategies to detect the asset pipeline lazily.
I'd be happy to explore that.
@jamesmartin I drafted a more flexible approach in #155, which still needs to be completed, where we don't rely on the initializer and lazily detect which asset finder adapter matches the environment unless the user sets one explicitly.
I can clean up and mark either one as ready for review, depending on your preference.
Thanks for continuing to push this forward. I haven't had the chance to properly think about the implications of this change. I'll try to get back to you soon.
This is still an issue. Should we add this work around to the documentation or reopen this pull request?