Cleanup Compass extension
This commit is contained in:
parent
d6f75afb3d
commit
072880d79c
1 changed files with 50 additions and 49 deletions
|
@ -1,60 +1,61 @@
|
||||||
# Forward the settings on config.rb and the result of registered extensions
|
module Middleman
|
||||||
# to Compass
|
module CoreExtensions
|
||||||
module Middleman::CoreExtensions::Compass
|
|
||||||
|
|
||||||
# Extension registered
|
# Forward the settings on config.rb and the result of registered
|
||||||
class << self
|
# extensions to Compass
|
||||||
|
module Compass
|
||||||
|
|
||||||
# Once registered
|
# Extension registered
|
||||||
def registered(app)
|
class << self
|
||||||
require "compass"
|
|
||||||
|
|
||||||
# Where to look for fonts
|
# Once registered
|
||||||
app.set :fonts_dir, "fonts"
|
def registered(app)
|
||||||
app.define_hook :compass_config
|
# Require the library
|
||||||
app.define_hook :after_compass_config
|
require "compass"
|
||||||
|
|
||||||
app.after_configuration do
|
# Where to look for fonts
|
||||||
::Compass.configuration do |config|
|
app.set :fonts_dir, "fonts"
|
||||||
config.project_path = source_dir
|
|
||||||
config.environment = :development
|
|
||||||
config.cache_path = File.join(root, ".sass-cache")
|
|
||||||
config.sass_dir = css_dir
|
|
||||||
config.css_dir = css_dir
|
|
||||||
config.javascripts_dir = js_dir
|
|
||||||
config.fonts_dir = fonts_dir
|
|
||||||
config.images_dir = images_dir
|
|
||||||
config.http_path = http_prefix
|
|
||||||
|
|
||||||
# Correctly support HTTP paths with generated sprites
|
# Hooks to manually update the compass config after we're
|
||||||
# if config.respond_to? :http_generated_images_path
|
# done with it
|
||||||
# config.http_generated_images_path = if app.respond_to? :http_generated_images_path
|
app.define_hook :compass_config
|
||||||
# app.http_generated_images_path
|
|
||||||
# else
|
|
||||||
# File.join(app.http_prefix || "/", app.images_dir)
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
|
|
||||||
config.asset_cache_buster :none
|
app.after_configuration do
|
||||||
config.relative_assets = false
|
::Compass.configuration do |config|
|
||||||
config.output_style = :nested
|
config.project_path = source_dir
|
||||||
|
config.environment = :development
|
||||||
|
config.cache_path = File.join(root, ".sass-cache")
|
||||||
|
config.sass_dir = css_dir
|
||||||
|
config.css_dir = css_dir
|
||||||
|
config.javascripts_dir = js_dir
|
||||||
|
config.fonts_dir = fonts_dir
|
||||||
|
config.images_dir = images_dir
|
||||||
|
config.http_path = http_prefix
|
||||||
|
|
||||||
if respond_to?(:asset_host) && asset_host.is_a?(Proc)
|
# Disable this initially, the cache_buster extension will
|
||||||
config.asset_host(&asset_host)
|
# re-enable it if requested.
|
||||||
|
config.asset_cache_buster :none
|
||||||
|
|
||||||
|
# Disable this initially, the relative_assets extension will
|
||||||
|
# re-enable it if requested.
|
||||||
|
config.relative_assets = false
|
||||||
|
|
||||||
|
# Default output style
|
||||||
|
config.output_style = :nested
|
||||||
|
|
||||||
|
if respond_to?(:asset_host) && asset_host.is_a?(Proc)
|
||||||
|
config.asset_host(&asset_host)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Call hook
|
||||||
|
run_hook :compass_config, ::Compass.configuration
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
alias :included :registered
|
||||||
# if build?
|
|
||||||
# ::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 :after_compass_config
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
alias :included :registered
|
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in a new issue