lib/sinatra/classy_assets.rb in classy_assets-0.0.2 vs lib/sinatra/classy_assets.rb in classy_assets-0.0.4

- old
+ new

@@ -5,33 +5,19 @@ require 'sinatra/sprockets-helpers' module Sinatra module ClassyAssets def self.registered(app) - app.set :asset_host, nil - app.set :assets_prefix, 'assets' - app.set :digest_assets, false - app.set :css_compressor, nil - app.set :js_compressor, nil - app.set :root, ::File.expand_path('../', __FILE__) - app.set :public_folder, ::File.join(app.settings.root, 'public') - app.set :sprockets, ::Sprockets::Environment.new(app.settings.root) - - app.use Rack::ClassyAssets, assets_prefix: app.settings.assets_prefix, - css_compressor: app.settings.css_compressor, - js_compressor: app.settings.js_compressor, - root: app.settings.root, - sprockets: app.settings.sprockets - + app.use Rack::ClassyAssets app.register ::Sinatra::Sprockets::Helpers app.configure_sprockets_helpers do |config| - manifest_file = ::File.join(app.settings.root, 'public', app.settings.assets_prefix, 'manifset.json') + manifest_file = ::File.join(::ClassyAssets::Configuration.public_path, ::ClassyAssets::Configuration.asset_prefix, 'manifset.json') - config.asset_host = app.settings.asset_host - config.manifest = ::Sprockets::Manifest.new(app.settings.sprockets, manifest_file) if ::File.exists? manifest_file - config.prefix = app.settings.assets_prefix - config.public_path = app.settings.public_folder - config.debug = true if app.development? + config.asset_host = ::ClassyAssets::Configuration.asset_host + 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 + config.debug = ::ClassyAssets::Configuration.debug_mode end end end register ClassyAssets end