I have attempted to create a new app, with app script, and I am attempting to use scriptlets but without success
function doGet() {
return HtmlService.createHtmlOutputFromFile('index');
}
function include(filename) {
return HtmlService.createHtmlOutputFromFile(filename).evaluate().getContent();
}
but nothing to do when verifying deployment doesn't work
<?!=include('Stylesheet'); ?>
please, help me!
CodePudding user response:
In your situation, if <?!=include('Stylesheet'); ?>
is included in index.html
file, how about the following modification?
From:
function doGet() {
return HtmlService.createHtmlOutputFromFile('index');
}
function include(filename) {
return HtmlService.createHtmlOutputFromFile(filename).evaluate().getContent();
}
To:
function doGet() {
return HtmlService.createTemplateFromFile('index').evaluate();
}
function include(filename) {
return HtmlService.createHtmlOutputFromFile(filename).getContent();
}
Note:
If
filename
ofinclude(filename)
has the scriptlets, please modify as follows.function include(filename) { return HtmlService.createTemplateFromFile(filename).evaluate().getContent(); }
In your script, it seems that Web Apps is used. In this case, when you modified the Google Apps Script, please modify the deployment as a new version. By this, the modified script is reflected in Web Apps. Please be careful this.
You can see the detail of this in the report of "Redeploying Web Apps without Changing URL of Web Apps for new IDE".