Permalink
Browse files

sort script files before compiling scripts.js

This way, stuff should appear in scripts.js the same each time it's compiled, instead of the random order you got before.
  • Loading branch information...
1 parent 9dbfcdc commit 5b39669fa030d84010da99df8eb8125ed6781e00 @christianp christianp committed Nov 10, 2016
Showing with 3 additions and 0 deletions.
  1. +3 −0 bin/numbas.py
View
@@ -271,9 +271,12 @@ def to_relative_url(path):
for dst,src in javascripts:
del files[dst]
+ javascripts.sort(key=lambda x:x[0])
+
javascripts = [src for dst,src in javascripts]
numbas_loader_path = os.path.join(options.path,'runtime','scripts','numbas.js')
javascripts.remove(numbas_loader_path)
+
javascripts.insert(0,numbas_loader_path)
javascripts = '\n'.join(open(src,encoding='utf-8').read() if isinstance(src,basestring) else src.read() for src in javascripts)
files[os.path.join('.','scripts.js')] = io.StringIO(javascripts)

0 comments on commit 5b39669

Please sign in to comment.