From 4a397972fad993cfdf7f6d9c6f20146734d16f4e Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Fri, 26 Apr 2013 10:33:42 -0400 Subject: [PATCH] Sort the css and js assets by numerical index --- common/lib/rooted_paths.py | 2 +- common/lib/xmodule/xmodule/static_content.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/lib/rooted_paths.py b/common/lib/rooted_paths.py index 9084768639..3339d6471d 100644 --- a/common/lib/rooted_paths.py +++ b/common/lib/rooted_paths.py @@ -8,7 +8,7 @@ def rooted_glob(root, glob): Uses glob2 globbing """ - return remove_root(root, glob2.glob('{root}/{glob}'.format(root=root, glob=glob))) + return remove_root(root, sorted(glob2.glob('{root}/{glob}'.format(root=root, glob=glob)))) def remove_root(root, paths): diff --git a/common/lib/xmodule/xmodule/static_content.py b/common/lib/xmodule/xmodule/static_content.py index c110d310eb..f433a9d6c9 100755 --- a/common/lib/xmodule/xmodule/static_content.py +++ b/common/lib/xmodule/xmodule/static_content.py @@ -68,7 +68,7 @@ def _write_styles(selector, output_root, classes): css_fragments[idx, filetype, fragment].add(class_.__name__) css_imports = defaultdict(set) for (idx, filetype, fragment), classes in sorted(css_fragments.items()): - fragment_name = "{idx}-{hash}.{type}".format( + fragment_name = "{idx:0=3d}-{hash}.{type}".format( idx=idx, hash=hashlib.md5(fragment).hexdigest(), type=filetype) @@ -102,7 +102,7 @@ def _write_js(output_root, classes): module_js = [] for idx, filetype, fragment in sorted(js_fragments): - path = output_root / "{idx}-{hash}.{type}".format( + path = output_root / "{idx:0=3d}-{hash}.{type}".format( idx=idx, hash=hashlib.md5(fragment).hexdigest(), type=filetype)