settings: Stop serving zxcvbn from node_modules/.

Now that we have the minified_source_filenames feature, we don't need
to serve zxcvbn from node_modules/ directly to avoid re-minifying it.

Moving this this allows us to stop shipping the (duplicate)
node_modules directory in release tarballs, which will save many
megabytes of unnecessary increase in our release tarball size.
This commit is contained in:
Tim Abbott 2017-02-06 16:29:00 -08:00
parent e2ee1951e0
commit babb6aaa47
4 changed files with 16 additions and 3 deletions

View File

@ -211,7 +211,13 @@ function _setup_page() {
if (page_params.password_auth_enabled !== false) {
// zxcvbn.js is pretty big, and is only needed on password
// change, so load it asynchronously.
$.getScript('/static/node_modules/zxcvbn/dist/zxcvbn.js', function () {
var zxcvbn_path = '/static/min/zxcvbn.js';
if (page_params.development_environment) {
// Usually the Django templates handle this path stuff
// for us, but in this case we need to hardcode it.
zxcvbn_path = '/static/node_modules/zxcvbn/dist/zxcvbn.js';
}
$.getScript(zxcvbn_path, function () {
$('#pw_strength .bar').removeClass("fade");
});
}

View File

@ -8,7 +8,7 @@ Form is validated both client-side using jquery-validate (see signup.js) and ser
{% block customhead %}
{{ super() }}
<script type="text/javascript" src="/static/node_modules/zxcvbn/dist/zxcvbn.js"></script>
{{ minified_js('zxcvbn')|safe }}
{% endblock %}
{% block portico_content %}

View File

@ -1,7 +1,7 @@
{% extends "zerver/portico_signup.html" %}
{% block customhead %}
{{ super() }}
<script type="text/javascript" src="/static/node_modules/zxcvbn/dist/zxcvbn.js"></script>
{{ minified_js('zxcvbn')|safe }}
{% endblock %}
{% block portico_content %}

View File

@ -754,6 +754,13 @@ JS_SPECS = {
],
'output_filename': 'min/signup.js'
},
'zxcvbn': {
'source_filenames': [],
'minifed_source_filenames': [
'node_modules/zxcvbn/dist/zxcvbn.js',
],
'output_filename': 'min/zxcvbn.js'
},
'api': {
'source_filenames': ['js/portico/api.js'],
'output_filename': 'min/api.js'