静态资源版本收敛到 FB_ASSET_V 常量 (#1)
原先 layout.php 与 install.php 各写一份 style.css?v=N,改样式时只改一处, 另一处会漂移 —— 实际就发生了:首页 v=10、安装页还是 v=7,两页样式不一致。 现在统一在 lib/bootstrap.php 定义 FB_ASSET_V,两处都引用它。 以后改 assets 下的 css/js,只改这一个数字。
This commit is contained in:
+1
-1
@@ -245,7 +245,7 @@ if (isset($_POST['do_install'])) {
|
|||||||
<link rel="icon" type="image/svg+xml" href="assets/favicon.svg">
|
<link rel="icon" type="image/svg+xml" href="assets/favicon.svg">
|
||||||
<link rel="icon" type="image/x-icon" href="assets/favicon.ico">
|
<link rel="icon" type="image/x-icon" href="assets/favicon.ico">
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="assets/apple-touch-icon.png">
|
<link rel="apple-touch-icon" sizes="180x180" href="assets/apple-touch-icon.png">
|
||||||
<link rel="stylesheet" href="assets/style.css?v=7">
|
<link rel="stylesheet" href="assets/style.css?v=<?php echo (int)FB_ASSET_V; ?>">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header class="topbar">
|
<header class="topbar">
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
|
|
||||||
if (!defined('FB_ROOT')) {
|
if (!defined('FB_ROOT')) {
|
||||||
define('FB_ROOT', dirname(__DIR__));
|
define('FB_ROOT', dirname(__DIR__));
|
||||||
|
// 静态资源版本号:改 assets/ 下的 css/js 后把这个数字 +1,
|
||||||
|
// 让浏览器与 CDN 缓存失效。全站只此一处,别再往页面里写死数字。
|
||||||
|
if (!defined('FB_ASSET_V')) { define('FB_ASSET_V', 10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------
|
/* ------------------------------------------------------------------
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@ function fb_layout_head($title, array $opt = []) {
|
|||||||
<link rel="icon" type="image/png" sizes="16x16" href="assets/favicon-16x16.png">
|
<link rel="icon" type="image/png" sizes="16x16" href="assets/favicon-16x16.png">
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="assets/apple-touch-icon.png">
|
<link rel="apple-touch-icon" sizes="180x180" href="assets/apple-touch-icon.png">
|
||||||
<link rel="manifest" href="assets/site.webmanifest">
|
<link rel="manifest" href="assets/site.webmanifest">
|
||||||
<link rel="stylesheet" href="assets/style.css?v=10">
|
<link rel="stylesheet" href="assets/style.css?v=<?php echo (int)FB_ASSET_V; ?>">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header class="topbar">
|
<header class="topbar">
|
||||||
|
|||||||
Reference in New Issue
Block a user