Home > Software engineering >  Embed html in html?
Embed html in html?

Time:05-17

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 Web App View

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 enter image description here

Resources:

  • Related