Class: Haml::Filters::SassRailsTemplate

Inherits:
Sass::Rails::SassTemplate
  • Object
show all
Defined in:
lib/haml/sass_rails_filter.rb

Overview

This is an extension of Sass::Rails’s SassTemplate class that allows Rails’s asset helpers to be used inside Haml Sass filter.

Direct Known Subclasses

ScssRailsTemplate

Instance Method Summary collapse

Instance Method Details

#render(scope = Object.new, locals = {}, &block)



8
9
10
11
12
13
14
15
16
# File 'lib/haml/sass_rails_filter.rb', line 8

def render(scope=Object.new, locals={}, &block)
  environment = ::Sprockets::Railtie.build_environment(::Rails.application)
  scope = environment.context_class.new(
    environment: environment,
    filename: "/",
    metadata: {}
  )
  super
end

#sass_options(scope)



24
25
26
27
28
# File 'lib/haml/sass_rails_filter.rb', line 24

def sass_options(scope)
  options = super
  options[:custom][:resolver] = ::ActionView::Base.new
  options
end