# Class: Haml::Filters::SassRailsTemplate

Inherits:
  Sass::Rails::SassTemplate
  - Object
  - Sass::Rails::SassTemplate
  - Haml::Filters::SassRailsTemplate
  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

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

## Instance Method Details

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

    9
    10
    11
    12
    13
    14
    15
    16
    17

    # File 'lib/haml/sass_rails_filter.rb', line 9

    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)

    25
    26
    27
    28
    29

    # File 'lib/haml/sass_rails_filter.rb', line 25

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