# encoding: utf-8 require 'rack/classy_assets' require 'sinatra/sprockets-helpers' module Sinatra module ClassyAssets def self.registered(app) app.use Rack::ClassyAssets app.register Sprockets::Helpers app.configure do ::Sprockets::Helpers.configure do |config| classy_config = ::ClassyAssets::Configuration manifest_file = ::File.join(config.public_path, classy_config.asset_prefix, 'manifset.json') config.asset_host = classy_config.asset_host config.debug = classy_config.debug_mode config.digest = classy_config.asset_digest config.environment = classy_config.sprockets config.public_path = classy_config.public_path config.prefix = "/#{classy_config.asset_prefix}" config.protocol = classy_config.asset_host_protocol if ::File.exists? manifest_file config.manifest = ::Sprockets::Manifest.new(config.environment, manifest_file) end end end end end register ClassyAssets end