I know that it uses
HtmlService to render userforms from HTML codes and that there is no native ways to write JS and CSS codes in separate files.
There is a trick to use a PHP-like function such as
//
function include(file : string) {
return HtmlService.createHtmlOutputFromFile(file).getContent();
};
and deal with the CSS and JS codes as HTML ones..
I think it makes sense to keep such functions in an external library which I name as library, right?
I I write the following code in a HTML file (where Userforms/ is a folder which includes client-css.html and client-js.html and other stuffs).
<!-- <?!= library.include("Userforms/client-css") ?> -->
..
<!-- <?!= library.include("Userforms/client-js") ?> -->
1 . Why comments are ignored in this case? (I only added them because it makes me wondering..)
2. it seems that the include function in the library library is only looking for the html files in the library project, but not in the calling project?
Exception: No HTML file named Userforms/client-css was found.
Thanks for any insights!