I'm looking to make some changes to an HTML file within the doGet() function before it's output in HTMLOut. However, I'm running into an issue with the
<?!=include('css').getContent();?>
code snippet, as it can't be executed and just becomes a part of the HTML text. Any assistance would be greatly appreciated. Here is the code:
function doGet(e) {
var landingPage;
landingPage=e.parameter.page ||'index';
var html=HtmlService.createHtmlOutputFromFile(landingPage);
var content=html.getContent();
content=content.replace("%%ToBeChanged%%","New Value");
var html2=HtmlService.createTemplate(content);
return html2.evaluate()
.setTitle('testing Website')
.addMetaTag('viewport', 'width=device-width, initial-scale=1');
}
Below is the index.html file within the project:
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>TITLE</title>
<?!=HtmlService.createHtmlOutputFromFile('styleSheet').getContent(); ?>
<?!=HtmlService.createHtmlOutputFromFile('script').getContent(); ?>
</head>
<body>
<form>
<input type='text' value='##ToBeChanged##'>
</form>
</body>
</html>