Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script Webapp-你能分离出客户端js吗?_Google Apps Script - Fatal编程技术网

Google apps script Webapp-你能分离出客户端js吗?

Google apps script Webapp-你能分离出客户端js吗?,google-apps-script,Google Apps Script,我构建GoogleWeb应用程序的方式是在html文件中包含所有客户端js,在code.gs文件中包含所有服务器端代码。有没有办法将JS从HTML中分离出来,同时将其保存在项目中?是的,请看一下Google的指南 应用程序脚本只允许.gs和.html文件,所以你必须将你的JS包装在标记中,并保存在html文件中。你只需要使用打印纸片就可以了,上面解释了[这里[(}),然后使用类似这样的函数函数include(filename){return HtmlService.createhtmloutfr

我构建GoogleWeb应用程序的方式是在html文件中包含所有客户端js,在code.gs文件中包含所有服务器端代码。有没有办法将JS从HTML中分离出来,同时将其保存在项目中?

是的,请看一下Google的指南


应用程序脚本只允许
.gs
.html
文件,所以你必须将你的JS包装在
标记中,并保存在html文件中。

你只需要使用打印纸片就可以了,上面解释了[这里[(}),然后使用类似这样的函数
函数include(filename){return HtmlService.createhtmloutfromfile](文件名).getContent();
}`