Module: Middleman::CoreExtensions::Compass

Defined in:
middleman-more/lib/middleman-more/core_extensions/compass.rb

Overview

Forward the settings on config.rb and the result of registered extensions to Compass

Class Method Summary (collapse)

Class Method Details

+ (Object) registered(app) Also known as: included

Once registered



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'middleman-more/lib/middleman-more/core_extensions/compass.rb', line 12

def registered(app)
  # Require the library
  require "compass"
      
  # Where to look for 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.after_configuration do
    ::Compass.configuration do |config|
      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

      # Disable this initially, the cache_buster extension will
      # 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