Class: HJ7::Compass::CompassConverter

Inherits:
Jekyll::Converter
  • Object
show all
Defined in:
lib/hj7/compass_converter.rb

Instance Method Summary collapse

Instance Method Details

#compassObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/hj7/compass_converter.rb', line 17

def compass
  if @config.has_key?("compass") and @config["compass"].has_key?("config_file")
    config_file = File.expand_path(@config["compass"]["config_file"])
    @_compass ||= ::Compass.add_project_configuration config_file
  else
    @_compass ||= ::Compass::Configuration::Data.new("jekyll", @config["compass"]).
      extend(::Compass::Configuration::Defaults).
      extend(::Compass::Configuration::Comments)
  end
  @_compass
end

#convert(scss) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/hj7/compass_converter.rb', line 29

def convert(scss)
  begin
    ::Sass::Engine.new(scss, compass.to_sass_engine_options).render
  rescue => e
    puts "Sass Exception: #{e.message}"
    puts "Scss: #{scss}"
  end
end

#matches(ext) ⇒ Object



9
10
11
# File 'lib/hj7/compass_converter.rb', line 9

def matches(ext)
  ext =~ /scss/i
end

#output_ext(ext) ⇒ Object



13
14
15
# File 'lib/hj7/compass_converter.rb', line 13

def output_ext(ext)
  ".css"
end