自定义h5模板的代码和资源没有被md5 cache

版本330

有自定义h5的版本,构建h5版本的时候,勾选了md5 cache
因为现在构建时,拷贝定制构建模板这一步骤是最后执行的
这是md5 cache的步骤已经过了,再拷贝自己的模板过去时,自己定制的部分,没有被md5,资源和代码都没有经过md5改名

请问这个问题该怎么处理呢

顶下,同问

请问解决了吗?

编辑器就是做了一个复制粘贴,实际使用起来没什么意义。
我现在用的方案是用python处理,例如添加meta信息、添加libs引用、修改名称、打包成gz等

大佬,能给一份相应的pytyon脚本吗,万分感谢 1925336724@qq.com

献丑了

import os, tarfile


path_read = []

def move():
    file = open(path_read[0], "r")
    fileadd = open(path_read[1], "r")
    content = file.read()
    contentadd = fileadd.read()
    file.close()
    fileadd.close()
    pos = contentadd.find('<meta name="x5-page-mode" content="app">')
    if pos != -1:
        contentadd = contentadd[:pos] + content + contentadd[pos:]
        file = open(path_read[1], "w")
        file.write(contentadd)
    file.close()
    print("move OK")


def change():
    a = open(path_read[1], encoding="utf-8").read()
    b = open(path_read[1], "w", encoding="utf-8")
    # replace title
    line = a.replace("Cocos Creator |", "")
    # add scprit
    line = line.replace("<!-- Import map -->", "<!-- Import map --><script src=\"libs/postmate.min.js\" charset=\"utf-8\"> </script>")
    line = line.replace("System.import('./index","window.handshake=window.handshake||new Postmate.Model({});\nSystem.import('./index")
    b.write(line)
    b.close()
    print("change OK")


def make_targz(output_filename, source_dir):
    with tarfile.open(output_filename, "w:gz") as tar:
        tar.add(source_dir, arcname=os.path.basename(""))
    print("compress OK")


if __name__ == '__main__':
    path_read = ["./build-templates/meta.html", "./build/web-mobile/index.html"]
    move()
    change()
    make_targz('./build/web-mobile.tar.gz', "./build/web-mobile")

meta.html里面就是你想添加的meta信息

非常感谢~~~