Sha256: c43a6b64f7adb60c38f1c180cc6cf2abbe065de4c96b777085530faa1adba45b
Contents?: true
Size: 1.56 KB
Versions: 2
Compression:
Stored size: 1.56 KB
Contents
# encoding: utf-8 require 'classy_assets' module Rack class ClassyAssets < Sinatra::Base def initialize(app) super(app) @sprockets = ::ClassyAssets::Configuration.sprockets end get "/#{::ClassyAssets::Configuration.asset_prefix}/:script.js" do |script| content_type("application/javascript") @sprockets["#{script}.js"] end get "/#{::ClassyAssets::Configuration.asset_prefix}/:stylesheet.css" do |stylesheet| content_type("text/css") @sprockets["#{stylesheet}.css"] end %w{jpg png gif}.each do |format| get "/#{::ClassyAssets::Configuration.asset_prefix}/:image.#{format}" do |image| content_type("image/#{format}") @sprockets["#{image}.#{format}"] end end get "/#{::ClassyAssets::Configuration.asset_prefix}/:font.ttf" do |font| content_type('application/x-font-truetype') @sprockets["#{font}.ttf"] end get "/#{::ClassyAssets::Configuration.asset_prefix}/:font.eot" do |font| content_type('application/vnd.ms-fontobject') @sprockets["#{font}.eot"] end get "/#{::ClassyAssets::Configuration.asset_prefix}/:font.svg" do |font| content_type('image/svg+xml') @sprockets["#{font}.svg"] end get "/#{::ClassyAssets::Configuration.asset_prefix}/:font.woff" do |font| content_type('application/x-font-woff') @sprockets["#{font}.woff"] end get "/#{::ClassyAssets::Configuration.asset_prefix}/:font.otf" do |font| content_type('application/x-font-opentype') @sprockets["#{font}.otf"] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
classy_assets-0.1.4 | lib/rack/classy_assets.rb |
classy_assets-0.1.3 | lib/rack/classy_assets.rb |