【发布时间】:2014-11-22 15:20:51
【问题描述】:
我是 Google Apps 脚本的新手,正在尝试在我的 Google 网站中实现 spacegallery。
我已经在脚本编辑器中将我的 css 样式表和 .js 文件分离为 .html 并编写了我的 html 页面 (minigallery.html),现在我正在尝试将它们全部链接到 Code.gs 部分。这是我到目前为止使用的示例: https://developers.google.com/apps-script/guides/html/best-practices#separate_html_css_and_javascript
这是我目前在我的 Code.gs 中的内容,但是当我运行已发布的版本时,css 和 js 文件似乎没有链接(当然我还没有放图片)。您可以在此处找到已发布的链接:
//script.google.com/macros/s/AKfycbybCtW9y-iCT81WvBoCmfGnXWhSwQ5dpa7xyHU_H1ot/dev
`
// Script-as-app template.
function doGet() {
var app = UiApp.createApplication().setTitle('Business Card Mini Gallery | MAvC Graphics.').setHeight(50).setWidth(100)
return HtmlService.createTemplateFromFile('minigallery')
.evaluate();
}function include(customcss) {
return HtmlService.createHtmlOutputFromFile('customcss')
.getContent();
}function include(layoutcss) {
return HtmlService.createHtmlOutputFromFile('layoutcss')
.getContent();
}function include(minigallerycss) {
return HtmlService.createHtmlOutputFromFile('minigallerycss')
.getContent();
}function include(eyesjs) {
return HtmlService.createHtmlOutputFromFile('eyejs')
.getContent();
}function include(jqueryjs) {
return HtmlService.createHtmlOutputFromFile('jqueryjs')
.getContent();
}function include(layoutjs) {
return HtmlService.createHtmlOutputFromFile('layoutjs')
.getContent();
}function include(utilsjs) {
return HtmlService.createHtmlOutputFromFile('utilsjs')
.getContent();
}function include(minigalleryjs) {
return HtmlService.createHtmlOutputFromFile('minigalleryjs')
.getContent();
}
` 这是我写得很糟糕的 minigallery.html 代码,用于链接 css 和 js(第一行和最后一行是最重要的):
<?!= include('customcss'), ('layoutcss'), ('minigallerycss'); ?>
...//lengthy inner page code
<?!= include('eyejs'), ('jqueryjs'), ('layoutjs'), ('minigalleryjs'), ('utilsjs'); ?>
为了使事情复杂化,我将整个内容从 spacegallery 重命名为 minigallery,但我已经适当地更改了所有文件。
【问题讨论】:
-
您具体遇到了什么问题?
-
将 css 和 js 文件链接到 html,因为当我查看已发布的页面时,它显示没有样式或操作
-
我没有收到任何调试错误
标签: javascript jquery html css google-apps-script