我有下一个index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> {{content-for 'head'}}
<meta name="fragment" content="!">
<link rel="icon" href="/assets/favicon.ico">
<link rel="stylesheet" href="{{rootURL}}assets/vendor.css?{{app-version hideSha=true}}">
<link rel="stylesheet" href="{{rootURL}}assets/ember-drink-it.css?{{app-version hideSha=true}}"> {{content-for 'head-footer'}}
</head>
<body>
{{content-for 'body'}}
<script src="{{rootURL}}assets/vendor.js?{{app-version hideSha=true}}"></script>
<script src="{{rootURL}}assets/ember-drink-it.js?{{app-version hideSha=true}}"></script>
{{content-for 'body-footer'}}
</body>
</html>我希望将版本添加到css和js文件中,以防止用户在版本增长时从缓存中加载这些文件。正如您所看到的,我已经尝试过使用ember-cli-app-version addon,但由于某些原因,它在index.html文件中无法工作。
那么,如何将版本添加到我的应用程序文件中呢?
发布于 2017-10-10 07:29:43
您已经提到,我希望将版本添加到css和js文件中,以防止用户在版本增长时从缓存中加载这些文件。
默认情况下,Ember在资产的url末尾放置一个md5散列。这样浏览器就可以跟踪更改。这叫做指纹。默认情况下,这是在生产生成中启用的。
要展望指纹,请看一下这位医生。
此外,如果要将版本用作指纹,则可以使用md5哈希,而可以自定义fingerprint选项。通过使用require('git-repo-version')获取值,并将值设置为customHash of fingerprint。
但是,默认配置已经足够了。
https://stackoverflow.com/questions/46660571
复制相似问题