Module: Opal::ERB
- Defined in:
- opal/lib/opal/erb.rb,
opal/lib/opal/sprockets/erb.rb
Defined Under Namespace
Class Method Summary collapse
-
.compile(source, file_name = '(erb)') ⇒ String
Compile ERB code into javascript.
Class Method Details
.compile(source, file_name = '(erb)') ⇒ String
Compile ERB code into javascript.
[Opal::ERB] can be used to compile [ERB] templates into javascript code. This module uses the [Opal::Compiler] internally.
Compiled templates, when run in a javascript environment, will appear
under the Template
namespace, and can be accessed as:
Template['template_name'] # => template instance
25 26 27 |
# File 'opal/lib/opal/erb.rb', line 25 def self.compile(source, file_name = '(erb)') Compiler.new(source, file_name).compile end |