From fa5ae9c7ceeb3effcf827d1958548588c184c619 Mon Sep 17 00:00:00 2001 From: virusdefender <1670873886@qq.com> Date: Sun, 13 Sep 2015 19:44:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20js=20=E5=8E=8B=E7=BC=A9?= =?UTF-8?q?=E5=92=8C=E8=AF=86=E5=88=AB=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/{static_md5.py => release_static.py} | 0 tools/template_js_path.py | 38 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) rename tools/{static_md5.py => release_static.py} (100%) create mode 100644 tools/template_js_path.py diff --git a/tools/static_md5.py b/tools/release_static.py similarity index 100% rename from tools/static_md5.py rename to tools/release_static.py diff --git a/tools/template_js_path.py b/tools/template_js_path.py new file mode 100644 index 0000000..1b92be5 --- /dev/null +++ b/tools/template_js_path.py @@ -0,0 +1,38 @@ +# coding=utf-8 +import hashlib +import re +import os +import shutil + +template_src_path = "template/src/" + +total_file = [] +module_list = [] + +print "\n\n-------------\n\n" +print u" //以下都是页面 script 标签引用的js" +for root, dirs, files in os.walk(template_src_path): + for name in files: + html_path = os.path.join(root, name) + html_content = open(html_path, "r").read() + r = re.search(re.compile(''), html_content) + + if r: + for item in r.groups(): + if item and "app" in item: + total_file.append(item) + +i = 0 +for item in set(total_file): + module_name = item.replace("/static/js/", "").split("/")[-1].replace(".js", "") + "_" + str(i) + + module_list.append(module_name) + print " " + module_name + "_pack" + ": \"" + item.replace("/static/js/", "").replace(".js", "") + "\"," + i += 1 + +print "\n\n-------------\n\n" + +for item in module_list: + print " {" + print " name: \"" + item + "_pack\"" + print " },"