lib/rails-sass-images/sass/inline.rb in rails-sass-images-1.0.0 vs lib/rails-sass-images/sass/inline.rb in rails-sass-images-1.0.1
- old
+ new
@@ -11,10 +11,13 @@
# font-family: "MyFont"
# src: inline("my.woff") format('woff')
def inline(path)
asset = RailsSassImages.asset(path)
- mime = MIME::Types.type_for(asset.to_s).first.content_type
+ mimes = MIME::Types.type_for(asset.to_s)
+ raise "Unknown MIME-type for #{ assets.to_s }" unless mimes.first
+
+ mime = mimes.first.content_type
file = asset.read
if mime == 'image/svg+xml'
file = CGI::escape(file).gsub('+', '%20')
encoding = 'charset=utf-8'