-
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
Not working without sprockets #95
Comments
@askehansen thanks for opening this issue. 👍
That seems the most likely cause of the problem. I haven't had a chance to try this gem with a vanilla Rails 6 project yet. I'll put this on my todo list. |
Just tested by upgrading a Rails 5.2 app to Rails 6.0.0.rc1: I'll have to figure out what's needed to make it work with Webpacker. |
Okay so I just noticed I had However I would like to contribute in making this gem not relying on sprockets. What is the disadvantage of doing this instead? class StaticAssetFinder
...
def pathname
Rails.root.join('assets', @filename)
end
end |
I realized I can write my own asset file loader and just use that instead: class BasicAssetFileLoader
def self.named(filename)
File.open("app/assets/#{filename}", "rb") do |file|
file.read
end
end
end
InlineSvg.configure do |config|
config.asset_file = BasicAssetFileLoader
end Again, sorry for the confusion and not reading the documentation! |
Added support for Webpacker in v1.5.0 |
When using this in a new rails 6 app i get the error:
undefined method 'assets' for #<Rails::Application::Configuration:0x00007ffba1c234f0>
I guess it fails here because rails 6 now uses webpacker instead of sprockets:
inline_svg/lib/inline_svg/static_asset_finder.rb
Line 16 in 8e9c3af
The text was updated successfully, but these errors were encountered: