css - 如何将 css 文件添加到 Squarespace 开发者模式
问题描述
我添加了index.css
内部样式,并将其包含在template.conf
:
{
"name": "Wright",
"author": "Squarespace, Inc.",
"layouts": {
"default": {
"name": "Default",
"regions": [
"site"
]
}
},
"stylesheets": [
"index.css"
],
etc...
}
我从文档中看到样式表将被编译成site.css
:
stylesheets
List of your stylesheet. Stylesheets will be compiled into site.css following the ordering here.
NOTE: If you add a file named reset.css to the /styles/ folder it will automatically get added to the top of the site.css file. It should not be listed in the "stylesheets" variable in template.conf.
site.css
这个文件在哪里?它是如何调用的site.region
?
目前,我无法以这种方式加载自定义 css 文件。
解决方案
该文件site.css
是所有 Squarespace 的默认样式以及stylesheets: [ ... ]
您在问题中添加的任何样式的编译结果输出。
每当您(或 Squarespace 的)样式表发生更改时,它都会自动为您创建。您没有对它的直接写入权限,并且不会在您的模板中看到它。
因此,如果您实际上已按照问题中所述完成(将文件添加到文件中/styles
并将其添加到template.conf
文件中),并且您随后通过 Git 更新了模板(请注意,SFTP 存在错误,可能不会更新您的文件) ,之后当用户加载网站时,您的 CSS 将包含在 site.css 中。
要回答您的最后一个问题,site.css 文件不是通过任何区域文件直接加载的。也就是说,如果你在代码中搜索它,你不会找到它。相反,它是作为 的一部分加载的{squarespace-headers}
,您可以在模板文件中找到它,无论是在.region
文件中还是在.block
文件中。
推荐阅读
- reactjs - React,如何将道具从父组件发送到子组件?(在渲染功能之外使用那些道具)
- android - 如何在不等待 FATAL ERROR 的情况下发送 crashlytic NON FATAL ERROR?
- python - 如何矢量化(即从中删除 for 循环)这段从时间序列生成离散 PDF 的代码
- flutter - 如何增加 AppBar 颤动的前导图标的大小
- mysql - 烘焙模板时cakephp4 mysql错误
- c# - c# vsto 调用 exe ,只工作一半
- sql - 如何使用超过 1 个条件进行删除查询?
- express - app.js 代码比较,因为 ejs 不工作
- python - 更好地使用 apply 来使用实际的迭代行和同一整列的行来计算新值
- lua - 罗技脚本绑定