File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -84,18 +84,20 @@ def assets_path(name)
8484 File . join ( "./assets" , SimpleCov ::Formatter ::HTMLFormatter ::VERSION , name )
8585 end
8686
87+ # Only have a few content types, just hardcode them
88+ CONTENT_TYPES = {
89+ ".js" => "text/javascript" ,
90+ ".png" => "image/png" ,
91+ ".gif" => "image/gif" ,
92+ ".css" => "text/css" ,
93+ } . freeze
94+
8795 def asset_inline ( name )
8896 path = File . join ( @public_assets_dir , name )
97+ base64_content = Base64 . strict_encode64 File . read ( path )
8998
90- # Only have a few content types, just hardcode them
91- content_type = {
92- ".js" => "text/javascript" ,
93- ".png" => "image/png" ,
94- ".gif" => "image/gif" ,
95- ".css" => "text/css" ,
96- } [ File . extname ( name ) ]
99+ content_type = CONTENT_TYPES [ File . extname ( name ) ]
97100
98- base64_content = Base64 . strict_encode64 File . read ( path )
99101 "data:#{ content_type } ;base64,#{ base64_content } "
100102 end
101103
You can’t perform that action at this time.
0 commit comments