我在Nginx上有一个带有sphinx
主题的Read the docs
文档。就像这样:
location ^~ /docs {
alias /path/to/docs/build/html/;
index index.html;
gzip on;
}
从缓存(<1s)加载页面时会出现一个微滞后:没有css样式的html文本。随着add_header Cache-Control no-cache;
的出现,这个问题消失了。我的文档页面不像docs.readthedocs.org那么大。Docs是由python3.6构建的,所有包都来自pypi。
发布于 2019-05-07 15:26:04
当css文件在js文件之前加载时,一切正常。但狮身人面像建设者把css包含在js之后。所以我写了脚本来修复这个问题:
for file in build/html/*html; do
links=$(sed -n '/.*rel=\"stylesheet\"/p' $file)
sed -i "/.*rel=\"stylesheet\"/d" $file
awk -v line="$links" "1;/.*/{ print line}" $file > $file.tmp
mv $file.tmp $file
echo $file updated
done</code></pre>
https://unix.stackexchange.com/questions/516971
复制相似问题