Include paths
-
Hi guys,
I am pretty new to Sketchup, RubyScript and webdialogs and i encounter an issue with writing webdialogs. Not sure if this is the correct forum to post, but feel free to correct me...I am writing a webdialog that edits data and i need to include an external css script and library. I can manage that with a relative path using something like
<link rel="stylesheet" href="../../../resources/css/webdialogs.css" />
I would like to include it with an absolute path, something like
<link rel="stylesheet" href="<myroot>/resources/css/webdialogs.css" />
Is there a way to get this root from within the webdialog?
-
BASE element | base object
[https://msdn.microsoft.com/en-us/library/ms535191(v=vs.85).aspx](https://msdn.microsoft.com/en-us/library/ms535191(v)... but it is more normal to have your plugins resources in a sub-directory of your plugin's sub-directory.
-
IN Ruby you can do interpolation in double-quoted strings with the
#{ }
operator. The expression between the curlies is evaluated and passed to the result'sto_s
method, then stuffed into the string.So you'd create a string of html:
html = %Q{ <html> <head> <base href="#{myroot}" /> <link rel="stylesheet" href="resources/css/webdialogs.css" /> </head> <body> </body> </html> } my_dialog.set_html(html)
You can also use a
HEREDOC
.
See: http://ruby-doc.org/core-2.0.0/doc/syntax/literals_rdoc.html
Advertisement