Load js fragments in order, so that Subview is loaded before the classes that use it

This commit is contained in:
Calen Pennington
2012-07-18 09:00:44 -04:00
parent 5026d6e9fb
commit 987fe17358
3 changed files with 10 additions and 8 deletions

View File

@@ -197,12 +197,13 @@ for descriptor in XModuleDescriptor.load_classes() + [RawDescriptor]:
module_js = descriptor.module_class.get_javascript()
for filetype in ('coffee', 'js'):
for fragment in descriptor_js.get(filetype, []) + module_js.get(filetype, []):
fragments.add((filetype, fragment))
for idx, fragment in enumerate(descriptor_js.get(filetype, []) + module_js.get(filetype, [])):
fragments.add((idx, filetype, fragment))
module_js_sources = []
for filetype, fragment in fragments:
path = os.path.join(js_file_dir, "{hash}.{type}".format(
for idx, filetype, fragment in sorted(fragments):
path = os.path.join(js_file_dir, "{idx}-{hash}.{type}".format(
idx=idx,
hash=hashlib.md5(fragment).hexdigest(),
type=filetype))
with open(path, 'w') as js_file:

View File

@@ -346,12 +346,13 @@ fragments = set()
for descriptor in XModuleDescriptor.load_classes() + [HiddenDescriptor]:
module_js = descriptor.module_class.get_javascript()
for filetype in ('coffee', 'js'):
for fragment in js.get(filetype, []):
fragments.add((filetype, fragment))
for idx, fragment in enumerate(module_js.get(filetype, [])):
fragments.add((idx, filetype, fragment))
module_js_sources = []
for filetype, fragment in fragments:
path = os.path.join(js_file_dir, "{hash}.{type}".format(
for idx, filetype, fragment in sorted(fragments):
path = os.path.join(js_file_dir, "{idx}-{hash}.{type}".format(
idx=idx,
hash=hashlib.md5(fragment).hexdigest(),
type=filetype))
with open(path, 'w') as js_file: