Sha256: 59d85e06b1b44f83bcc8611599fe38cbbf5779a8a18d88b25da8c946345ff495

Contents?: true

Size: 588 Bytes

Versions: 40

Compression:

Stored size: 588 Bytes

Contents

module Sinatra::AssetHelpers

  def stylesheet(s)
    s += '.css' unless s.include?('.css')
    s = asset_path(s) unless s =~ /^https?:\// or s =~ /^\/\/.+/
    "<link rel='stylesheet' href='#{s}' />"
  end

  def javascript(s)
    s += '.js' unless s.include?('.js')
    s = asset_path(s) unless s =~ /^https?:\// or s =~ /^\/\/.+/
    "<script type='text/javascript' src='#{s}'></script>"
  end

  def asset_path(source, options={})
    source = ('/assets/' + source).gsub('//', '/').gsub('/assets/assets/', '/assets/')
  end

  def image_path(source)
    asset_path(source)
  end

end

Version data entries

40 entries across 40 versions & 2 rubygems

Version Path
fanforce-app-factory-1.7.1 lib/fanforce/app_factory/config/helpers/assets.rb
fanforce-app-factory-1.7.0 lib/fanforce/app_factory/config/helpers/assets.rb
fanforce-app-factory-1.6.3 lib/fanforce/app_factory/config/helpers/assets.rb
fanforce-app-factory-1.6.2 lib/fanforce/app_factory/config/helpers/assets.rb
fanforce-app-factory-1.6.1 lib/fanforce/app_factory/config/helpers/assets.rb
fanforce-app-factory-1.6.0 lib/fanforce/app_factory/config/helpers/assets.rb
fanforce-app-factory-1.5.0 lib/fanforce/app_factory/config/helpers/assets.rb
fanforce-app-factory-1.4.4 lib/fanforce/app_factory/config/helpers/assets.rb
fanforce-app-factory-1.4.3 lib/fanforce/app_factory/config/helpers/assets.rb
fanforce-app-factory-1.4.2 lib/fanforce/app_factory/config/helpers/assets.rb
fanforce-app-factory-1.4.1 lib/fanforce/app_factory/config/helpers/assets.rb
fanforce-app-factory-1.4.0 lib/fanforce/app_factory/config/helpers/assets.rb
fanforce-app-factory-1.3.0 lib/fanforce/app_factory/config/helpers/assets.rb
fanforce-app-factory-1.2.0 lib/fanforce/app_factory/config/helpers/assets.rb
fanforce-app-factory-1.1.0 lib/fanforce/app_factory/config/helpers/assets.rb
fanforce-app-factory-1.0.0 lib/fanforce/app_factory/config/helpers/assets.rb
fanforce-app-factory-0.40.1 lib/fanforce/app_factory/config/helpers/assets.rb
fanforce-app-factory-0.40.0 lib/fanforce/app_factory/config/helpers/assets.rb
fanforce-app-factory-0.39.1 lib/fanforce/app_factory/config/helpers/assets.rb
fanforce-app-factory-0.39.0 lib/fanforce/app_factory/config/helpers/assets.rb