Class: ScssFilter

Inherits:
TextFilter
  • Object
show all
Defined in:
lib/scss_filter.rb

Instance Method Summary collapse

Instance Method Details

#filter(text) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/scss_filter.rb', line 7

def filter(text)
  begin
    options = Compass.sass_engine_options || {:load_paths => []}
    options[:load_paths].unshift "#{Rails.root}/public/stylesheets/scss"
    options[:syntax] = :scss
    # this would need some substitions (as in paperclip) to be useful
    # options[:load_paths] += Radiant::Config['sheets.sass_template_paths'].split(',').map(&:strip) if Radiant::Config['sheets.sass_template_paths']
    Sass::Engine.new(text, options).render
  rescue Sass::SyntaxError
    "Syntax Error at line #{$!.sass_line}: " + $!.to_s
  end
end