If you are going to use #set_html (as I do) then you must also read the css and all the js files into Ruby strings and insert them into the html string.
I do this as well. But I use %{key} replacement parameters in the html file.
So for example, within your "windowPlusSuHtmlDialog.html" file:
<!DOCTYPE html>
<html>
<head>
<style>
%{modus}
</style>
<script>%{jquery}</script>
<script>%{bootstrap}</script>
<script>%{vue}</script>
<style>
%{wPlusStyles}
</style>
</head>
<body>
<!-- etc., etc. -->
And then in your Ruby you load the resource files into a hash of strings:
html = File.read(html_file_path)
resources = Hash[
:modus, File.read(modus_file_path),
:bootstrap, File.read(bootstrap_file_path),
:vue, File.read(vue_file_path),
:wPlusStyles, File.read(wPlusStyles_file_path),
]
# Replace %{parameters} in HTML text with resource strings,
# and pass it to the dialog object:
dialog.set_html( html % resources )
For information on how the % method replaces %{parameters} with string values in a hash identified by matching symbol keys, see the Ruby Core Doc for the String#% method. (The 3rd example shows the replacement of %{foo} in a string with the value keyed by :foo in the argument hash.)
Now the real benefit isn’t so much with the resources, it is when we need to dynamically build parts of the html <body> such as dynamically populating controls or stuffing model data into a table.
For this I use little HTML template fragments for say a table row with each data fields
being a %{fieldname} replaceable parameter. And then I’ll use that HTML fragment in an iterator block repeatedly stuffing data into it using the String#% method.
After I have the table body string all built up, I’ll put it into the hash with the other replacement strings identified with say a :table_data key, and when I do the replacement on the html file text, it will replace the %{table_data} parameter within the <tbody> element in the HTML.