Class: Sass::Rails::SassTemplate

Inherits:
Tilt::SassTemplate
  • Object
show all
Defined in:
lib/sass/rails/template_handlers.rb

Direct Known Subclasses

ScssTemplate

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.engine_initialized?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/sass/rails/template_handlers.rb', line 34

def self.engine_initialized?
  defined?(::Sass::Engine)
end

Instance Method Details

#evaluate(scope, locals, &block) ⇒ Object



74
75
76
# File 'lib/sass/rails/template_handlers.rb', line 74

def evaluate(scope, locals, &block)
  Sass::Engine.new(data, sass_options(scope)).render
end

#importer(scope) ⇒ Object



67
68
69
# File 'lib/sass/rails/template_handlers.rb', line 67

def importer(scope)
  Sass::Rails::Importer.new(scope)
end

#initialize_engineObject



38
39
40
# File 'lib/sass/rails/template_handlers.rb', line 38

def initialize_engine
  require_template_library 'sass'
end

#prepareObject



71
72
# File 'lib/sass/rails/template_handlers.rb', line 71

def prepare
end

#sass_options(scope) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/sass/rails/template_handlers.rb', line 50

def sass_options(scope)
  importer = self.importer(scope)
  options = sass_options_from_rails(scope)
  load_paths = (options[:load_paths] || []).dup
  load_paths.unshift(importer)
  options.merge(
    :filename => eval_file,
    :line => line,
    :syntax => syntax,
    :importer => importer,
    :load_paths => load_paths,
    :custom => {
      :resolver => Resolver.new(scope)
    }
  )
end

#sass_options_from_rails(scope) ⇒ Object



46
47
48
# File 'lib/sass/rails/template_handlers.rb', line 46

def sass_options_from_rails(scope)
  scope.environment.context_class.sass_config
end

#syntaxObject



42
43
44
# File 'lib/sass/rails/template_handlers.rb', line 42

def syntax
  :sass
end