Parent

Included Modules

Less::Rails::LessTemplate

Constants

TO_CSS_KEYS

Public Instance Methods

evaluate(scope, locals, &block) click to toggle source
# File lib/less/rails/template_handlers.rb, line 14
def evaluate(scope, locals, &block)
  @output ||= begin
    Less.Parser['scope'] = scope
    parser = ::Less::Parser.new config_to_less_parser_options(scope)
    engine = parser.parse(data)
    engine.to_css config_to_css_options(scope)
  end
end
prepare() click to toggle source
# File lib/less/rails/template_handlers.rb, line 11
def prepare
end

Protected Instance Methods

config_from_rails(scope) click to toggle source
# File lib/less/rails/template_handlers.rb, line 40
def config_from_rails(scope)
  scope.environment.context_class.less_config
end
config_paths(scope) click to toggle source
# File lib/less/rails/template_handlers.rb, line 36
def config_paths(scope)
  config_from_rails(scope)[:paths]
end
config_to_css_options(scope) click to toggle source
# File lib/less/rails/template_handlers.rb, line 32
def config_to_css_options(scope)
  Hash[config_from_rails(scope).each.to_a].slice *TO_CSS_KEYS
end
config_to_less_parser_options(scope) click to toggle source
# File lib/less/rails/template_handlers.rb, line 25
def config_to_less_parser_options(scope)
  paths = config_paths(scope) + scope.environment.paths
  local_path = scope.pathname.dirname
  paths += [local_path] unless paths.include? local_path
  {:filename => eval_file, :line => line, :paths => paths, :dumpLineNumbers => config_from_rails(scope).line_numbers}
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.