Class: Opal::TiltTemplate

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.compiler_optionsObject



25
26
27
# File 'opal/lib/tilt/opal.rb', line 25

def self.compiler_options
  Opal::Config.compiler_options.merge(requirable: true)
end

.engine_initialized?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'opal/lib/tilt/opal.rb', line 17

def self.engine_initialized?
  true
end

.inherited(subclass) ⇒ Object



13
14
15
# File 'opal/lib/tilt/opal.rb', line 13

def self.inherited(subclass)
  subclass.default_mime_type = 'application/javascript'
end

.versionObject



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

def self.version
  ::Opal::VERSION
end

Instance Method Details

#compiler_optionsObject



48
49
50
# File 'opal/lib/tilt/opal.rb', line 48

def compiler_options
  self.class.compiler_options
end

#evaluate(_, _, &block) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
# File 'opal/lib/tilt/opal.rb', line 36

def evaluate(_, _, &block)
  if builder = @options[:builder]
    builder.dup.build(file).to_s
  elsif @options[:build]
    Opal::Builder.build(file).to_s
  else
    compiler_options = (compiler_options || {}).merge!(file: file)
    compiler = Compiler.new(data, compiler_options)
    compiler.compile.to_s
  end
end

#initialize_engineObject



29
30
31
# File 'opal/lib/tilt/opal.rb', line 29

def initialize_engine
  require_template_library 'opal'
end

#prepareObject



33
34
# File 'opal/lib/tilt/opal.rb', line 33

def prepare
end