Sha256: 67b857df6bd4b266cd6ec9292f102939a4f8b5edb92eaee1172beee59b4b75fb
Contents?: true
Size: 887 Bytes
Versions: 5
Compression:
Stored size: 887 Bytes
Contents
# frozen_string_literal: true module EasyML module ApplicationHelper # Override: Returns the engine assets manifest. def easy_ml_manifest ViteRuby.new(root: EasyML::Engine.root).manifest end def prod_script_tags vite_manifest = Thread.current[:vite_manifest] ||= JSON.parse(File.read(EasyML::Engine.root.join("public/easy_ml/assets/.vite/manifest.json"))) entrypoint = vite_manifest.dig("entrypoints/Application.tsx") application_js = entrypoint.dig("file") css_files = entrypoint.dig("css") # Create HTML tags for the JavaScript and CSS using Rails tag helpers tags = [] tags << javascript_include_tag("/easy_ml/assets/#{application_js}", type: "module") css_files.each do |css_file| tags << stylesheet_link_tag("/easy_ml/assets/#{css_file}") end tags.join("\n").html_safe end end end
Version data entries
5 entries across 5 versions & 1 rubygems