Sha256: cf69766f0121bc94c2913c1bd4e26e3d4a17fa6166b9d7d0d285768e64d387da
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
module Sinatra module AssetPack module Helpers def css(name, options={}) show_asset_pack :css, name, options end def js(name, options={}) show_asset_pack :js, name, options end def img(src, options={}) attrs = { :src => src }.merge(options) local = settings.assets.local_file_for src if local i = Image.new(local) attrs[:src] = BusterHelpers.add_cache_buster(src, local) if i.dimensions? attrs[:width] ||= i.width attrs[:height] ||= i.height end end "<img#{HtmlHelpers.kv attrs} />" end def show_asset_pack(type, name, options={}) pack = settings.assets.packages["#{name}.#{type}"] return "" unless pack if settings.production? pack.to_production_html options else pack.to_development_html options end end def asset_filter_css(str) Css.preproc str, settings.assets end def asset_path_for(file, from) settings.assets.dyn_local_file_for file, from end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sinatra-assetpack-0.0.5 | lib/sinatra/assetpack/helpers.rb |