Sha256: 23f7ed68c635b9280298173ecac68d88e9f85aed8107555f7d89f7fdb405cbac

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

# 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}"

          if ::File.exists? manifest_file
            config.manifest = ::Sprockets::Manifest.new(config.environment, manifest_file)
          end
        end
      end
    end
  end
  register ClassyAssets
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
classy_assets-0.3.0 lib/sinatra/classy_assets.rb
classy_assets-0.2.0 lib/sinatra/classy_assets.rb