Google apps script Google脚本:使用导入项目中的html文件
我想在一个通用的google脚本项目中保留公共资源,如css和js,然后将它们导入不同的项目(web应用程序) 因此,不要使用本地文件:Google apps script Google脚本:使用导入项目中的html文件,google-apps-script,web-applications,Google Apps Script,Web Applications,我想在一个通用的google脚本项目中保留公共资源,如css和js,然后将它们导入不同的项目(web应用程序) 因此,不要使用本地文件: <?!= HtmlService.createHtmlOutputFromFile('CSS').getContent(); ?> 我想使用导入文件中的资源(参考资料>库>导入项目)在库中,您需要共享HTML文件以及返回其内容的函数。然后可以在项目中调用这些函数 图书馆 代码G.gs: /** * Gets the CSS fil
<?!= HtmlService.createHtmlOutputFromFile('CSS').getContent(); ?>
我想使用导入文件中的资源(参考资料>库>导入项目)在库中,您需要共享HTML文件以及返回其内容的函数。然后可以在项目中调用这些函数 图书馆 代码G.gs:
/**
* Gets the CSS file as HTML and returns its content.
* @returns {string}
*/
function getCss() {
return HtmlService.createHtmlOutputFromFile("CSS").getContent();
}
CSS.html
<style>
p {
background-color: yellow;
}
</style>
Index.html
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<?!= Library.getCss(); ?>
</head>
<body>
<p>Hello</p>
</body>
</html>
你好
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<?!= Library.getCss(); ?>
</head>
<body>
<p>Hello</p>
</body>
</html>