Class: AlFolioDistill::RuntimeScriptsTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- AlFolioDistill::RuntimeScriptsTag
- Defined in:
- lib/al_folio_distill.rb
Overview
Emits the vendored Distill runtime with integrity pinned to the committed provenance digests, plus the loader descriptor the patched polyfill transform reads when it re-injects the template tag.
Instance Method Summary collapse
Instance Method Details
#render(context) ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/al_folio_distill.rb', line 109 def render(context) site = context.registers[:site] return "" unless site && AlFolioDistill.enabled?(site) lines = [ "<script>", " window.alFolioDistill = window.alFolioDistill || {};", " window.alFolioDistill.templateLoader = #{json_literal(AlFolioDistill.template_loader(site))};", "</script>", ] AlFolioDistill::RUNTIME_SCRIPTS.each do |asset| lines << script_tag(AlFolioDistill.runtime_url(site, asset), AlFolioDistill.integrity_for(asset)) end lines.join("\n") end |