lib/sinatra/assetpack/helpers.rb in sinatra-assetpack-0.3.1 vs lib/sinatra/assetpack/helpers.rb in sinatra-assetpack-0.3.2
- old
+ new
@@ -8,13 +8,18 @@
def js(*args)
show_asset_pack :js, *args
end
def img(src, options={})
- attrs = { :src => HtmlHelpers.get_file_uri(src, settings.assets) }
+ attrs = { :src => image_path(src) }
attrs = attrs.merge(options)
"<img#{HtmlHelpers.kv attrs} />"
+ end
+
+ def image_path(src)
+ file_path = HtmlHelpers.get_file_uri(src, settings.assets)
+ File.join(request.script_name, file_path)
end
def show_asset_pack(type, *args)
names = Array.new
while args.first.is_a?(Symbol)