Sha256: bd33ba14c1ebb793c441569717ef449241013842672d9111abc5332d2eb1be48
Contents?: true
Size: 1.66 KB
Versions: 5
Compression:
Stored size: 1.66 KB
Contents
# encoding: utf-8 require 'sinatra/base' require 'sprockets' require "sprockets-sass" require "sass" require 'coffee_script' 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
5 entries across 5 versions & 1 rubygems