浏览代码

Generate build id. Use build id as cache id

Riccardo Balbo 4 年之前
父节点
当前提交
d4578caae4
共有 2 个文件被更改,包括 4 次插入3 次删除
  1. 1 1
      make.sh
  2. 3 2
      static/js/CacheUtils.js

+ 1 - 1
make.sh

@@ -26,7 +26,7 @@ fi
 
 
 if [ "$DONT_COMPILE_LESS" = "" ];
 if [ "$DONT_COMPILE_LESS" = "" ];
 then
 then
-    export CMD="npm install less -g&&lessc static/css/style.less static/css/style.css&&$CMD"    
+    export CMD="sleep 2&&echo 'export default \"`date +%s`\"'> static/js/build-id.js&&npm install less -g&&lessc static/css/style.less static/css/style.css&&$CMD"    
 fi
 fi
 
 
 
 

+ 3 - 2
static/js/CacheUtils.js

@@ -1,7 +1,8 @@
+import _buildId from "./build-id.js";
+
 export default class Cache {
 export default class Cache {
     static getCacheId(){
     static getCacheId(){
-        return "dQL5aNkS";
-
+        return _buildId;
     }
     }
     static buildFullKey(key){
     static buildFullKey(key){
         key="jme-"+key+"-cache";
         key="jme-"+key+"-cache";