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

Fix bad reference to Sprockets::Asset.pathname #106

Merged
merged 1 commit into from
Mar 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/inline_svg/static_asset_finder.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require "pathname"

# Naive fallback asset finder for when sprockets >= 3.0 &&
# config.assets.precompile = false
# Thanks to @ryanswood for the original code:
# https://github.com/AbleHealth/inline_svg/commit/661bbb3bef7d1b4bd6ccd63f5f018305797b9509
# https://github.com/jamesmartin/inline_svg/commit/661bbb3bef7d1b4bd6ccd63f5f018305797b9509
module InlineSvg
class StaticAssetFinder
def self.find_asset(filename)
Expand All @@ -14,7 +16,7 @@ def initialize(filename)

def pathname
if ::Rails.application.config.assets.compile
::Rails.application.assets[@filename].pathname
Pathname.new(::Rails.application.assets[@filename].filename)
else
manifest = ::Rails.application.assets_manifest
asset_path = manifest.assets[@filename]
Expand Down