Class: Lutaml::Xsd::Spa::Strategies::VueInlinedStrategy

Inherits:
OutputStrategy
  • Object
show all
Defined in:
lib/lutaml/xsd/spa/strategies/vue_inlined_strategy.rb

Overview

VueInlinedStrategy - Generates a single HTML file with Vue app inlined

This is the DEFAULT strategy that generates a self-contained HTML file with all CSS and JavaScript embedded directly. This works reliably on all browsers including when opened via file:// protocol.

Examples:

strategy = VueInlinedStrategy.new(
  'output/docs.html',
  config_loader,
  verbose: true
)
files = strategy.generate(data, renderer)

Instance Attribute Summary collapse

Attributes inherited from OutputStrategy

#verbose

Instance Method Summary collapse

Methods inherited from OutputStrategy

#write

Constructor Details

#initialize(output_path, config_loader, verbose: false) ⇒ VueInlinedStrategy

Initialize Vue inlined strategy

Parameters:

  • output_path (String)

    Output file path

  • config_loader (ConfigurationLoader)

    Configuration loader

  • verbose (Boolean) (defaults to: false)

    Enable verbose output



31
32
33
34
35
# File 'lib/lutaml/xsd/spa/strategies/vue_inlined_strategy.rb', line 31

def initialize(output_path, config_loader, verbose: false)
  super(verbose: verbose)
  @output_path = output_path
  @config_loader = config_loader
end

Instance Attribute Details

#config_loaderObject (readonly)

Returns the value of attribute config_loader.



24
25
26
# File 'lib/lutaml/xsd/spa/strategies/vue_inlined_strategy.rb', line 24

def config_loader
  @config_loader
end

#output_pathObject (readonly)

Returns the value of attribute output_path.



24
25
26
# File 'lib/lutaml/xsd/spa/strategies/vue_inlined_strategy.rb', line 24

def output_path
  @output_path
end

Instance Method Details

#generate(data, _renderer) ⇒ Array<String>

Generate single HTML file with Vue app inlined

Parameters:

  • data (Hash)

    Serialized schema data

  • renderer (TemplateRenderer)

    Template renderer (unused for Vue mode)

Returns:

  • (Array<String>)

    List containing single file path



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/lutaml/xsd/spa/strategies/vue_inlined_strategy.rb', line 42

def generate(data, _renderer)
  log "Generating Vue inlined SPA (single HTML with all assets embedded)..."

  # Read pre-built assets
  app_js = read_frontend_asset("app.iife.js")
  app_css = read_frontend_asset("style.css")

  # Build complete HTML document
  html = build_html_document(data, app_js, app_css)

  # Write to file
  prepare_output
  files = [write_file(output_path, html)]

  log "✓ Vue inlined SPA generated: #{output_path}"
  files
end