I am building a web app in Google Apps Script for the maker space that I run at an ES and it is slowly getting longer and more complicated. I don't have much HTML training, but in OOP I can manage complexity by creating functions and classes rather than just generating a single giant script. Is there something similar in HTML? I way to write multiple HTML files and then call them individually?
For example, I would like to add this
Any suggestions?
CodePudding user response:
document.write(include('stickyNote'))
CodePudding user response:
Update the include()
method to evaluate the HTML content.
function include(filename) {
return HtmlService.createTemplateFromFile(filename).evaluate().getContent();
}
The evaluation that happens in the doGet()
will not correctly evaluate the nested HTML because it's already been included as
Resources:
- I have followed the same structure as per the Apps Script sample about Separate HTML, CSS, and JavaScript