Class: Middleman::CoreExtensions::Compass
- Defined in:
- lib/middleman-more/core_extensions/compass.rb
Defined Under Namespace
Classes: CompassSassTemplate, CompassScssTemplate
Instance Attribute Summary
Attributes inherited from Extension
Instance Method Summary collapse
- #after_configuration ⇒ Object
-
#initialize(app, options_hash = {}, &block) ⇒ Compass
constructor
A new instance of Compass.
Methods inherited from Extension
activate, activated_extension, after_extension_activated, clear_after_extension_callbacks, config, extension_name, helpers, option, register
Constructor Details
#initialize(app, options_hash = {}, &block) ⇒ Compass
Returns a new instance of Compass.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/middleman-more/core_extensions/compass.rb', line 6 def initialize(app, ={}, &block) super # Hooks to manually update the compass config after we're # done with it app.define_hook :compass_config # Location of SASS/SCSS files external to source directory. # @return [Array] # config[:sass_assets_paths] = ["#{root}/assets/sass/", "/path/2/external/sass/repository/"] app.config.define_setting :sass_assets_paths, [], 'Paths to extra SASS/SCSS files' end |
Instance Method Details
#after_configuration ⇒ Object
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 55 56 57 58 59 60 |
# File 'lib/middleman-more/core_extensions/compass.rb', line 19 def after_configuration ::Compass.configuration do |compass_config| compass_config.project_path = app.source_dir compass_config.environment = :development compass_config.cache_path = app.config[:sass_cache_path] compass_config.sass_dir = app.config[:css_dir] compass_config.css_dir = app.config[:css_dir] compass_config.javascripts_dir = app.config[:js_dir] compass_config.fonts_dir = app.config[:fonts_dir] compass_config.images_dir = app.config[:images_dir] compass_config.http_path = app.config[:http_prefix] app.config[:sass_assets_paths].each do |path| compass_config.add_import_path path end # Disable this initially, the cache_buster extension will # re-enable it if requested. compass_config.asset_cache_buster { |_| nil } # Disable this initially, the relative_assets extension will compass_config.relative_assets = false # Default output style compass_config.output_style = :nested # No line-comments in test mode (changing paths mess with sha1) compass_config.line_comments = false if ENV["TEST"] end # Call hook app.run_hook :compass_config, ::Compass.configuration # Tell Tilt to use it as well (for inline sass blocks) ::Tilt.register 'sass', CompassSassTemplate ::Tilt.prefer(CompassSassTemplate) # Tell Tilt to use it as well (for inline scss blocks) ::Tilt.register 'scss', CompassScssTemplate ::Tilt.prefer(CompassScssTemplate) end |