lib/sinatra/classy_assets.rb in classy_assets-0.1.4 vs lib/sinatra/classy_assets.rb in classy_assets-0.2.0
- old
+ new
@@ -5,21 +5,29 @@
module Sinatra
module ClassyAssets
def self.registered(app)
app.use Rack::ClassyAssets
- app.register ::Sinatra::Sprockets::Helpers
- app.configure_sprockets_helpers do |config|
- manifest_file = ::File.join(::ClassyAssets::Configuration.public_path, ::ClassyAssets::Configuration.asset_prefix, 'manifset.json')
+ 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.asset_host = ::ClassyAssets::Configuration.asset_host
- config.debug = ::ClassyAssets::Configuration.debug_mode
- config.digest = ::ClassyAssets::Configuration.asset_digest
- config.environment = ::ClassyAssets::Configuration.sprockets
- config.manifest = ::Sprockets::Manifest.new(::ClassyAssets::Configuration.sprockets, manifest_file) if ::File.exists? manifest_file
- config.prefix = ::ClassyAssets::Configuration.asset_prefix
- config.public_path = ::ClassyAssets::Configuration.public_path
- end
+ if ::File.exists? manifest_file
+ config.manifest = ::Sprockets::Manifest.new(config.environment, manifest_file)
+ end
+ end
+ end
end
end
register ClassyAssets
end