Error loading modus stylesheet inside ruby script

How can I insert modus style inside my html if it’s in my ruby script with EOT?

Suposing my script is in the same folder as modus.min.css with the code below the console shows:
Failed to load resource: net::ERR_FILE_NOT_FOUND

html = <<-EOT
        <link rel="stylesheet" href="modus.min.css" />

Got it!

@moduslocation = File.join(__dir__, '/modus.min.css')

<link rel="stylesheet" href="#{@moduslocation}" />
1 Like

FYI: File.join will add the slash between arguments.

When you use UI::HtmlDialog#set_html it writes a temporary file to the TEMP path folder. So the CEF subprocess would likely be looking for the resource in the TEMP folder.

Absolute paths are always a good way to avoid ambiguity of file location.

1 Like