Sha256: b8ab4c2dd3593ee970bd39fcba69a4ba080929e9cf2d7ca3e49e5c7cf47f8e31

Contents?: true

Size: 641 Bytes

Versions: 1

Compression:

Stored size: 641 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 = Stache.template_base_path.join(exploded.join("/"), "_#{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

1 entries across 1 versions & 1 rubygems

Version Path
stache-0.0.3 lib/stache/asset_helper.rb