You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
module SiteHelper
|
|
|
|
|
|
def frontend_javascript_importmap_tags
|
|
|
only_use = %w"application"
|
|
|
importmap_json = JSON.parse(Rails.application.importmap.to_json(resolver: self))['imports'].select{ |k,v| only_use.include?(k)}
|
|
|
safe_join [
|
|
|
javascript_inline_importmap_tag(JSON.pretty_generate({ "imports" => importmap_json})),
|
|
|
javascript_module_preload_tag(*importmap_json.map{|v| v[1]}),
|
|
|
javascript_import_module_tag('application')
|
|
|
], "\n"
|
|
|
end
|
|
|
|
|
|
end
|