Sha256: 74d1e7f247135904af89876b304e7c14844642fa937095d66058224dc900dd35
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
module Perkins class Assets < Sinatra::Base require "haml_coffee_assets" configure do set :assets, (Sprockets::Environment.new { |env| env.append_path(settings.root + "/assets/images") env.append_path(settings.root + "/assets/javascripts") env.append_path(settings.root + "/assets/stylesheets") # compress everything in production if ENV["RACK_ENV"] == "production" env.js_compressor = YUI::JavaScriptCompressor.new env.css_compressor = YUI::CssCompressor.new end }) end get "/assets/app.js" do content_type("application/javascript") settings.assets["app.js"] end get "/assets/app.css" do content_type("text/css") settings.assets["app.css"] end %w{jpg png gif}.each do |format| get "/assets/:image.#{format}" do |image| content_type("image/#{format}") settings.assets["#{image}.#{format}"] end end get "/assets/:image.svg" do |image| content_type("image/svg+xml") settings.assets["#{image}.svg"] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
perkins-0.0.3 | lib/perkins/assets.rb |
perkins-0.0.2 | lib/perkins/assets.rb |