Sha256: a88f1b4f8f6e054168778cf1c1d6a53600c3f764bf04cf3e5992db226e047a74

Contents?: true

Size: 837 Bytes

Versions: 1

Compression:

Stored size: 837 Bytes

Contents

require "ember_cli/capture"
require "ember_cli/assets"

module EmberRailsHelper
  def render_ember_app(name, &block)
    EmberCli[name].build

    markup_capturer = EmberCli::Capture.new(sprockets: self, &block)

    head, body = markup_capturer.capture

    render inline: EmberCli[name].index_html(head: head, body: body)
  end

  def include_ember_script_tags(name, **options)
    EmberCli[name].build

    assets = EmberCli::Assets.new(EmberCli[name])

    assets.javascript_assets.
      map { |src| %{<script src="#{src}"></script>}.html_safe }.
      reduce(&:+)
  end

  def include_ember_stylesheet_tags(name, **options)
    EmberCli[name].build

    assets = EmberCli::Assets.new(EmberCli[name])

    assets.stylesheet_assets.
      map { |src| %{<link rel="stylesheet" href="#{src}">}.html_safe }.
      reduce(&:+)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ember-cli-rails-0.6.0 app/helpers/ember_rails_helper.rb