Sha256: 9e2553bf618ee3fd94473b41c51e14003c20914a1c01e24f6ecd6c91c6a73694

Contents?: true

Size: 632 Bytes

Versions: 2

Compression:

Stored size: 632 Bytes

Contents

module Stache
  module AssetHelper
    # template_include_tag("widgets/basic_text_api_data")
    # template_include_tag("shared/test_thing")
    def template_include_tag(*sources)
      sources.collect do |source|
        exploded = source.split("/")
        file = exploded.pop
        file = file.split(".").first
        template_path = ::Rails.root.join('app/views', *exploded, "_#{file}.html.mustache")
        template = ::File.open(template_path, "rb")
        content_tag(:script, template.read.html_safe, :type => "text/html", :id => "#{file.dasherize.underscore}_template")
      end.join("\n").html_safe
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stache-0.0.2 lib/stache/asset_helper.rb
stache-0.0.1 lib/stache/asset_helper.rb