Class: Awestruct::Handlers::CssTiltHandler

Inherits:
BaseTiltHandler show all
Defined in:
lib/awestruct/handlers/css_tilt_handler.rb

Constant Summary collapse

CHAIN =
Awestruct::HandlerChain.new(/\.(sass|scss|less)$/,
  Awestruct::Handlers::FileHandler,
  Awestruct::Handlers::CssTiltHandler
)

Instance Attribute Summary

Attributes inherited from BaseHandler

#delegate, #site

Instance Method Summary collapse

Methods inherited from BaseTiltHandler

#content_syntax, #double_extension?, #input_extension, #output_extension, #output_filename, #rendered_content, #simple_name, #source_file_name

Methods inherited from BaseHandler

#content_line_offset, #content_syntax, #dependencies, #execute_shell, #front_matter, #inherit_front_matter, #input_mtime, #output_extension, #output_filename, #output_path, #path, #raw_content, #relative_source_path, #rendered_content, #simple_name, #stale?, #to_chain

Constructor Details

#initialize(site, delegate) ⇒ CssTiltHandler

Returns a new instance of CssTiltHandler.



15
16
17
# File 'lib/awestruct/handlers/css_tilt_handler.rb', line 15

def initialize(site, delegate)
  super( site, delegate )
end

Instance Method Details

#optionsObject

Sass Engine requires dynamically generated options.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/awestruct/handlers/css_tilt_handler.rb', line 22

def options
  opts = super

  # Sass / Scss
  opts[:load_paths] ||= []

  if defined?(::Compass)
    ::Compass::Frameworks::ALL.each do |framework|
      opts[:load_paths] << framework.stylesheets_directory
    end
    opts[:load_paths] << ::Compass::SpriteImporter.new
  end
  opts[:load_paths] << File.join(site.config.dir.to_s, File.dirname(relative_source_path) ) unless relative_source_path.nil?

  # Less use Paths instead of load_paths
  opts[:paths] = opts[:load_paths]

  return opts
end