Module: Dart::Rails::DartAssetHelper
- Defined in:
- lib/dart/rails/dart_asset_helper.rb
Overview
ActionView helper mixin for dart
Instance Method Summary collapse
-
#dart_include_tag(*sources) ⇒ Object
Returns html_safe dart/application script tag.
-
#dart_path(source, options = {}) ⇒ Object
(also: #path_to_dart)
Returns path to dart script, similar to javascript_path.
Instance Method Details
#dart_include_tag(*sources) ⇒ Object
Returns html_safe dart/application script tag. Example:
'<script src="/assets/dart_app.dart" type="application/dart"></script>'
Remember: only one dart script-tag is allowed!
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/dart/rails/dart_asset_helper.rb', line 15 def dart_include_tag(*sources) = sources..stringify_keys sources.uniq.map { |source| = { 'src' => dart_path(source, ), 'type' => 'application/dart' }.merge() content_tag(:script, '', ) }.join('\n').html_safe end |
#dart_path(source, options = {}) ⇒ Object Also known as: path_to_dart
Returns path to dart script, similar to javascript_path
27 28 29 |
# File 'lib/dart/rails/dart_asset_helper.rb', line 27 def dart_path(source, = {}) path_to_asset(source, { :extname => '.dart' }.merge!()) end |