Class: Tilt::StylusTemplate

Inherits:
Template
  • Object
show all
Defined in:
lib/stylus/tilt/stylus.rb

Direct Known Subclasses

Stylus::Rails::StylusTemplate

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.engine_initialized?Boolean

Internal: Checks if the Stylus module has been properly defined.

Returns true if the ‘Stylus’ module is present.

Returns:

  • (Boolean)


21
22
23
# File 'lib/stylus/tilt/stylus.rb', line 21

def self.engine_initialized?
  defined? ::Stylus
end

Instance Method Details

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

Internal: Compile the template Stylus using this instance options. The current ‘scope’ and given ‘locals’ are ignored and the output is cached.

Returns a String with the compiled stylesheet with CSS syntax.



46
47
48
# File 'lib/stylus/tilt/stylus.rb', line 46

def evaluate(scope, locals, &block)
  @output ||= Stylus.compile(data, options)
end

#initialize_engineObject

Internal: Require the ‘stylus’ file to load the Stylus module.

Returns nothing.



28
29
30
# File 'lib/stylus/tilt/stylus.rb', line 28

def initialize_engine
  require_template_library 'stylus'
end

#prepareObject

Internal: Caches the filename as an option entry if it’s present.

Returns nothing.



35
36
37
38
39
# File 'lib/stylus/tilt/stylus.rb', line 35

def prepare
  if self.file
    options[:filename] ||= self.file
  end
end