Class: Haml::Filters::Opal
- Inherits:
-
Base
- Object
- Base
- Haml::Filters::Opal
- Defined in:
- lib/opal/rails/haml6_filter.rb
Instance Method Summary collapse
Instance Method Details
#compile(node) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/opal/rails/haml6_filter.rb', line 12 def compile(node) template = [:multi] template << [:static, "<script type='#{mime_type}'>\n"] template << [:static, ::Opal.compile(node.value[:text])] template << [:static, "\n</script>"] template end |
#mime_type ⇒ Object
8 9 10 |
# File 'lib/opal/rails/haml6_filter.rb', line 8 def mime_type ::Opal::Config.esm ? 'module' : 'text/javascript' end |