static: Restore bundling KaTeX and zxcvbn via django-pipeline.

Since we need KaTeX to be available for zerver/lib/tex.py and
static/third/katex/cli.js to be able to shell out to it.  However, for
some reason, the KaTeX we bundle using Webpack doesn't seem to be
importable by Node (and it's also kinda a pain to find its filename
from `cli.js`).

So, we work around this by just using the legacy system for KaTeX.

Something similar is needed for zxcvbn.js, in order to support the
settings_account.js use case (basically deferred loading of this
file); that requires JS code to have access to the correct path for
zxcvbn.
This commit is contained in:
Tim Abbott
2018-01-23 12:06:41 -08:00
parent 852af0e3c5
commit 56395f40d2

View File

@@ -1114,7 +1114,28 @@ JS_SPECS = {
'sockjs': {
'source_filenames': ['third/sockjs/sockjs-0.3.4.js'],
'output_filename': 'min/sockjs-0.3.4.min.js'
}
},
# Even though we've moved the main KaTeX copy into Webpack, we
# also need KaTeX to be runnable directly via Node (Called from
# zerver/lib/tex.py which calls static/third/katex/cli.js. Since
# our Webpack setup doesn't provide a good way to name the current
# version of a module, we use the legacy django-pipeline system
# for bundling KaTeX.
'katex': {
'source_filenames': [
'node_modules/katex/dist/katex.js',
],
'output_filename': 'min/katex.js',
},
# The same legacy treatment is required for zxcvbn, in order to
# support the settings_account.js use case (where we don't have a
# good way to look up the path to the file).
'zxcvbn': {
'source_filenames': [
'node_modules/zxcvbn/dist/zxcvbn.js',
],
'output_filename': 'min/zxcvbn.js'
},
}
app_srcs = JS_SPECS['app']['source_filenames']