Class: Lutaml::UmlRepository::StaticSite::Output::VueInlinedStrategy

Inherits:
Strategy
  • Object
show all
Defined in:
lib/lutaml/uml_repository/static_site/output/vue_inlined_strategy.rb

Overview

Generates a single self-contained HTML file with embedded pre-built Vue IIFE, CSS, and JSON data.

Matches the pattern used by lutaml-xsd and lutaml-jsonschema: data in window.SPA_DATA, Vue app reads it and renders.

Constant Summary collapse

FRONTEND_DIST =
File.expand_path(
  "../../../../../frontend/dist", __dir__
)

Instance Method Summary collapse

Methods inherited from Strategy

#initialize

Constructor Details

This class inherits a constructor from Lutaml::UmlRepository::StaticSite::Output::Strategy

Instance Method Details

#render(spa_document, search_index) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/lutaml/uml_repository/static_site/output/vue_inlined_strategy.rb', line 20

def render(spa_document, search_index)
  FileUtils.mkdir_p(File.dirname(output_path))

  js = read_frontend_asset("app.iife.js")
  css = read_frontend_asset("style.css")

  data_json = build_data_json(spa_document, search_index)
  html = build_html(data_json, js, css)

  File.write(output_path, html)
  output_path
end