Method: StaticMatic::RenderMixin#generate_css

Defined in:
lib/staticmatic/mixins/render.rb

#generate_css(source, source_dir = '') ⇒ Object



76
77
78
79
80
81
82
83
84
85
# File 'lib/staticmatic/mixins/render.rb', line 76

def generate_css(source, source_dir = '')
  full_file_path = File.join(@src_dir, 'stylesheets', source_dir, "#{source}.sass")
  begin
    sass_options = { :load_paths => [ File.join(@src_dir, 'stylesheets') ] }.merge(self.configuration.sass_options)
    stylesheet = Sass::Engine.new(File.read(full_file_path), sass_options)
    stylesheet.to_css
  rescue Exception => e
    render_rescue_from_error(StaticMatic::TemplateError.new(full_file_path, e))
  end
end