module Dart::Rails::DartAssetHelper

ActionView helper mixin for dart

Public Instance Methods

dart_include_tag(*sources) click to toggle source

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!

# File lib/dart/rails/dart_asset_helper.rb, line 15
def dart_include_tag(*sources)
  options = sources.extract_options!.stringify_keys
  sources.uniq.map { |source|
    tag_options = {
      'src' => dart_path(source, options),
      'type' => 'application/dart'
    }.merge(options)
    content_tag(:script, '', tag_options)
  }.join('\n').html_safe
end
dart_path(source, options = {}) click to toggle source

Returns path to dart script, similar to javascript_path

# File lib/dart/rails/dart_asset_helper.rb, line 27
def dart_path(source, options = {})
  path_to_asset(source, { :extname => '.dart' }.merge!(options))
end
Also aliased as: path_to_dart
path_to_dart(source, options = {})
Alias for: dart_path