Skip to content

Commit

Permalink
Corrige le helper svg_tag_base64 en production (sans l'asset pipeline)
Browse files Browse the repository at this point in the history
En production, quand l'asset pipeline est désactivé
(config.assets.compile = false), les assets peuvent être retrouvés avec
la propriété `Rails.application.assets_manifest`.

rails/sprockets-rails#237 (comment)
  • Loading branch information
etienneCharignon committed Oct 12, 2020
1 parent e58b825 commit be6f9be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def md(contenu)
end

def svg_tag_base64(path, options = {})
raw = Rails.application.assets[path].to_s
raw = Rails.application.assets_manifest.find_sources(path).first
encodage = Base64.strict_encode64 raw
image_src64 = "data:image/svg+xml;base64,#{encodage}"
image_tag image_src64, options
Expand Down

0 comments on commit be6f9be

Please sign in to comment.