Module: Glslkit::Rails::Helper

Defined in:
lib/glslkit/rails/helper.rb

Overview

ActionView上でincludeされるビューヘルパー (§4.3)。

Instance Method Summary collapse

Instance Method Details

#glsl_manifest_tag(**html_options) ⇒ Object

<%= glsl_manifest_tag %> =>



20
21
22
23
24
25
26
# File 'lib/glslkit/rails/helper.rb', line 20

def glsl_manifest_tag(**html_options)
  html_options[:id] ||= "glsl-manifest"
  html_options[:type] = "application/json"
  apply_glsl_nonce!(html_options)

  (:script, escape_closing_script_tags(Glslkit::Rails.manifest.to_json).html_safe, html_options)
end

#glsl_script_tag(logical_path, **html_options) ⇒ Object

<%= glsl_script_tag "pbr.vert" %> =>



9
10
11
12
13
14
15
16
# File 'lib/glslkit/rails/helper.rb', line 9

def glsl_script_tag(logical_path, **html_options)
  asset = find_glsl_asset(logical_path)
  html_options[:id] ||= glsl_script_id(logical_path.to_s)
  html_options[:type] = asset.content_type.to_s
  apply_glsl_nonce!(html_options)

  (:script, escape_closing_script_tags(asset.compiled_content).html_safe, html_options)
end