Commit 4a397972 by Calen Pennington

Sort the css and js assets by numerical index

parent fdaa708f
...@@ -8,7 +8,7 @@ def rooted_glob(root, glob): ...@@ -8,7 +8,7 @@ def rooted_glob(root, glob):
Uses glob2 globbing 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): def remove_root(root, paths):
......
...@@ -68,7 +68,7 @@ def _write_styles(selector, output_root, classes): ...@@ -68,7 +68,7 @@ def _write_styles(selector, output_root, classes):
css_fragments[idx, filetype, fragment].add(class_.__name__) css_fragments[idx, filetype, fragment].add(class_.__name__)
css_imports = defaultdict(set) css_imports = defaultdict(set)
for (idx, filetype, fragment), classes in sorted(css_fragments.items()): 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, idx=idx,
hash=hashlib.md5(fragment).hexdigest(), hash=hashlib.md5(fragment).hexdigest(),
type=filetype) type=filetype)
...@@ -102,7 +102,7 @@ def _write_js(output_root, classes): ...@@ -102,7 +102,7 @@ def _write_js(output_root, classes):
module_js = [] module_js = []
for idx, filetype, fragment in sorted(js_fragments): 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, idx=idx,
hash=hashlib.md5(fragment).hexdigest(), hash=hashlib.md5(fragment).hexdigest(),
type=filetype) type=filetype)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment