Module: Maglev::ApplicationHelper

Includes:
ViteRails::TagHelpers
Defined in:
app/helpers/maglev/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#maglev_asset_manifestObject



23
24
25
# File 'app/helpers/maglev/application_helper.rb', line 23

def maglev_asset_manifest
  ::Maglev::Engine.vite_ruby.manifest
end

#maglev_live_preview_client_javascript_tagObject



14
15
16
17
18
19
20
21
# File 'app/helpers/maglev/application_helper.rb', line 14

def maglev_live_preview_client_javascript_tag
  # no need to render the tag when the site is being visited outside the editor
  return '' unless maglev_rendering_mode == :editor

  entries = maglev_asset_manifest.resolve_entries(*%w[live-preview-rails-client], type: :javascript)

  javascript_include_tag(*entries.fetch(:scripts).flatten.uniq, crossorigin: 'anonymous', type: 'module')
end

#vite_manifestObject



10
11
12
# File 'app/helpers/maglev/application_helper.rb', line 10

def vite_manifest
  use_engine_vite? ? maglev_asset_manifest : super
end