refactor: 静态资源缓存破坏改为文件级哈希,重启不刷新未修改文件的缓存
- 启动时计算每个 JS/CSS 的 SHA-1 前 8 位作为版本号 - 文件不变则哈希不变,浏览器继续用缓存,重启零压力 - 替换全局 AssetVersion 为 assetV 模板函数,按文件路径查询哈希 - 移除 BuildPageData 中的全局版本号注入
This commit is contained in:
@ -48,10 +48,10 @@
|
||||
{{/* MD 内容安全传递给 JS */}}
|
||||
<textarea id="postMdContent" style="display:none">{{.Post.Body}}</textarea>
|
||||
|
||||
<link rel="stylesheet" href="/static/vditor/dist/index.css">
|
||||
<script src="/static/vditor/dist/method.min.js"></script>
|
||||
<script src="/static/js/common.js?v={{.V}}"></script>
|
||||
<script src="/static/js/shortcode.js?v={{.V}}"></script>
|
||||
<link rel="stylesheet" href="/static/vditor/dist/index.css?v={{assetV "/static/vditor/dist/index.css"}}">
|
||||
<script src="/static/vditor/dist/method.min.js?v={{assetV "/static/vditor/dist/method.min.js"}}"></script>
|
||||
<script src="/static/js/common.js?v={{assetV "/static/js/common.js"}}"></script>
|
||||
<script src="/static/js/shortcode.js?v={{assetV "/static/js/shortcode.js"}}"></script>
|
||||
<script>
|
||||
(function() {
|
||||
var el = document.getElementById('postContent');
|
||||
|
||||
Reference in New Issue
Block a user