原理:
通过 crc32 编码将文件变成唯一可识别的文件。
前提:
本工具只适用于使用了 res 模块开发的项目,并且项目的代码中没有使用过文件路径而是完全使用的 res 的 key 或者 eui 中的 class。
比如代码中存在 "assets/CheckBox/checkbox_select_down.png" 或者 "resource/eui_skins/ItemRendererSkin.exml" 均不可以使用。
需要最新的 node.js 版本 http://nodejs.cn/
命令:
node generate.js --releasePath "../../Temp/e/Eui/bin-release/web/v1" --resPath "resource/default.res.json" --resourceRoot "resource" --thmPath "resource/default.thm.json"
--releasePath web 项目发布的目录 (相对或者绝对路径)
--resPath 代码中 res 文件路径,比如 "resource/default.res.json"
--thmPath 代码中 thm 文件路径,比如 "resource/default.thm.json"
--resourceRoot loadConfig 时传入的资源路径 RES.loadConfig("resource/default.res.json", "resource/"); 比如这里的 "resource" 不带后面的 "/"
示例:
v1_before: egret publish 发布后的版本
v1_after: 执行命令后的生成的唯一名称文件
热更新:
1、备份原来的服务器的 index.html 文件
2、将脚本执行后的文件覆盖原始项目
3、服务器确保 index.html 下载是最新的,比如改成 index.html?v=2
更新日志
3月8日
解决 font 、sheet 拷贝文件错误的问题
|
|