Cleanup Compass extension

This commit is contained in:
Thomas Reynolds 2012-04-26 15:53:45 -07:00
parent d6f75afb3d
commit 072880d79c

View file

@ -1,18 +1,24 @@
# Forward the settings on config.rb and the result of registered extensions module Middleman
# to Compass module CoreExtensions
module Middleman::CoreExtensions::Compass
# Forward the settings on config.rb and the result of registered
# extensions to Compass
module Compass
# Extension registered # Extension registered
class << self class << self
# Once registered # Once registered
def registered(app) def registered(app)
# Require the library
require "compass" require "compass"
# Where to look for fonts # Where to look for fonts
app.set :fonts_dir, "fonts" app.set :fonts_dir, "fonts"
# Hooks to manually update the compass config after we're
# done with it
app.define_hook :compass_config app.define_hook :compass_config
app.define_hook :after_compass_config
app.after_configuration do app.after_configuration do
::Compass.configuration do |config| ::Compass.configuration do |config|
@ -26,17 +32,15 @@ module Middleman::CoreExtensions::Compass
config.images_dir = images_dir config.images_dir = images_dir
config.http_path = http_prefix config.http_path = http_prefix
# Correctly support HTTP paths with generated sprites # Disable this initially, the cache_buster extension will
# if config.respond_to? :http_generated_images_path # re-enable it if requested.
# config.http_generated_images_path = if app.respond_to? :http_generated_images_path
# app.http_generated_images_path
# else
# File.join(app.http_prefix || "/", app.images_dir)
# end
# end
config.asset_cache_buster :none config.asset_cache_buster :none
# Disable this initially, the relative_assets extension will
# re-enable it if requested.
config.relative_assets = false config.relative_assets = false
# Default output style
config.output_style = :nested config.output_style = :nested
if respond_to?(:asset_host) && asset_host.is_a?(Proc) if respond_to?(:asset_host) && asset_host.is_a?(Proc)
@ -44,17 +48,14 @@ module Middleman::CoreExtensions::Compass
end end
end end
# if build? # Call hook
# ::Compass.configuration do |config|
# config.environment = :production
# config.project_path = File.join(root, build_dir)
# end
# end
run_hook :compass_config, ::Compass.configuration run_hook :compass_config, ::Compass.configuration
run_hook :after_compass_config
end end
end end
alias :included :registered alias :included :registered
end end
end
end
end end