Class: Sprockets::Sass::SassTemplate
- Inherits:
-
Tilt::SassTemplate
- Object
- Tilt::SassTemplate
- Sprockets::Sass::SassTemplate
- Defined in:
- lib/sprockets/sass/sass_template.rb
Direct Known Subclasses
Instance Attribute Summary (collapse)
-
- (Object) context
readonly
A reference to the current Sprockets context.
Class Method Summary (collapse)
-
+ (Boolean) engine_initialized?
Templates are initialized once the.
Instance Method Summary (collapse)
-
- (Object) evaluate(context, locals, &block)
See `Tilt::Template#evaluate`.
-
- (Object) initialize_engine
Add the Sass functions if they haven't already been added.
-
- (Object) prepare
See `Tilt::Template#prepare`.
-
- (Object) syntax
Define the expected syntax for the template.
Instance Attribute Details
- (Object) context (readonly)
A reference to the current Sprockets context
9 10 11 |
# File 'lib/sprockets/sass/sass_template.rb', line 9 def context @context end |
Class Method Details
+ (Boolean) engine_initialized?
Templates are initialized once the
12 13 14 |
# File 'lib/sprockets/sass/sass_template.rb', line 12 def self.engine_initialized? super && defined?(@@sass_functions_added) end |
Instance Method Details
- (Object) evaluate(context, locals, &block)
See `Tilt::Template#evaluate`.
46 47 48 49 50 51 |
# File 'lib/sprockets/sass/sass_template.rb', line 46 def evaluate(context, locals, &block) @output ||= begin @context = context ::Sass::Engine.new(data, ).render end end |
- (Object) initialize_engine
Add the Sass functions if they haven't already been added.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/sprockets/sass/sass_template.rb', line 17 def initialize_engine super if Sass.add_sass_functions begin require "sprockets/sass/functions" rescue LoadError # Safely ignore load issues, because # sprockets-helpers may not be available. @@sass_functions_added = false end @@sass_functions_added = true else @@sass_functions_added = false end end |
- (Object) prepare
See `Tilt::Template#prepare`.
40 41 42 43 |
# File 'lib/sprockets/sass/sass_template.rb', line 40 def prepare @context = nil @output = nil end |
- (Object) syntax
Define the expected syntax for the template
35 36 37 |
# File 'lib/sprockets/sass/sass_template.rb', line 35 def syntax :sass end |