diff --git a/docs/subsystems/front-end-build-process.md b/docs/subsystems/front-end-build-process.md index 10b0a90066..b580ac79bd 100644 --- a/docs/subsystems/front-end-build-process.md +++ b/docs/subsystems/front-end-build-process.md @@ -70,8 +70,8 @@ needs to be accessible from one of the entry points defined in `app` and `common` bundles. * If it's just used on a single standalone page (e.g. `/stats`), create a new entry point in `tools/webpack.assets.json`. Use the - `render_bundle` function in the relevant Jinja2 template to inject - the compiled JS and CSS. + `bundle` macro (defined in `templates/zerver/base.html`) in the + relevant Jinja2 template to inject the compiled JS and CSS. If you want to test minified files in development, look for the `DEBUG =` line in `zproject/settings.py` and set it to `False`. diff --git a/templates/analytics/activity.html b/templates/analytics/activity.html index 89c67493f8..9b9d9eda83 100644 --- a/templates/analytics/activity.html +++ b/templates/analytics/activity.html @@ -9,7 +9,7 @@ {% block customhead %} {{ super() }} -{{ render_bundle('activity') }} +{{ bundle('activity') }} {% endblock %} {% block content %} diff --git a/templates/analytics/stats.html b/templates/analytics/stats.html index 38d5106ea0..51387ba928 100644 --- a/templates/analytics/stats.html +++ b/templates/analytics/stats.html @@ -7,14 +7,14 @@ {% endblock %} {% block customhead %} -{{ render_bundle('portico') }} +{{ bundle('portico') }} {% endblock %} {% block content %}
- {{ render_bundle('translations') }} - {{ render_bundle('stats') }} + {{ bundle('translations') }} + {{ bundle('stats') }}
diff --git a/templates/analytics/support.html b/templates/analytics/support.html index 4fedf94c16..e10c364ba7 100644 --- a/templates/analytics/support.html +++ b/templates/analytics/support.html @@ -9,8 +9,8 @@ {% block customhead %} {{ super() }} -{{ render_bundle('activity') }} -{{ render_bundle('support') }} +{{ bundle('activity') }} +{{ bundle('support') }} {% endblock %} {% block content %} diff --git a/templates/confirmation/confirm_preregistrationuser.html b/templates/confirmation/confirm_preregistrationuser.html index 1ee3eb5bea..9e8b987e4e 100644 --- a/templates/confirmation/confirm_preregistrationuser.html +++ b/templates/confirmation/confirm_preregistrationuser.html @@ -2,7 +2,7 @@ {% block customhead %} {{ super() }} -{{ render_bundle('confirm-preregistrationuser') }} +{{ bundle('confirm-preregistrationuser') }} {% endblock %} {% block content %} diff --git a/templates/corporate/billing.html b/templates/corporate/billing.html index 4a854380a4..26fad6015f 100644 --- a/templates/corporate/billing.html +++ b/templates/corporate/billing.html @@ -2,8 +2,8 @@ {% block customhead %} -{{ render_bundle('landing-page') }} -{{ render_bundle('billing') }} +{{ bundle('landing-page') }} +{{ bundle('billing') }} {% endblock %} @@ -13,7 +13,7 @@ {% include 'zerver/billing_nav.html' %} - {{ render_bundle('translations') }} + {{ bundle('translations') }}
diff --git a/templates/corporate/jobs.html b/templates/corporate/jobs.html index 0c639bf4ec..dd3d96aa33 100644 --- a/templates/corporate/jobs.html +++ b/templates/corporate/jobs.html @@ -6,7 +6,7 @@ {% block customhead %} -{{ render_bundle('landing-page') }} +{{ bundle('landing-page') }} {% endblock %} {% block portico_content %} diff --git a/templates/corporate/upgrade.html b/templates/corporate/upgrade.html index 7bce30e6a8..cfa10e8e00 100644 --- a/templates/corporate/upgrade.html +++ b/templates/corporate/upgrade.html @@ -11,8 +11,8 @@ {% block customhead %} -{{ render_bundle('landing-page') }} -{{ render_bundle('upgrade') }} +{{ bundle('landing-page') }} +{{ bundle('upgrade') }} {% endblock %} @@ -22,7 +22,7 @@ {% include 'zerver/billing_nav.html' %} - {{ render_bundle('translations') }} + {{ bundle('translations') }}
diff --git a/templates/corporate/zephyr.html b/templates/corporate/zephyr.html index 4fb3a97b3a..5bd9119513 100644 --- a/templates/corporate/zephyr.html +++ b/templates/corporate/zephyr.html @@ -6,7 +6,7 @@ {% block customhead %} -{{ render_bundle('landing-page') }} +{{ bundle('landing-page') }} {% endblock %} {% block portico_content %} diff --git a/templates/zerver/app/index.html b/templates/zerver/app/index.html index 7087302d58..b2ac7fd77f 100644 --- a/templates/zerver/app/index.html +++ b/templates/zerver/app/index.html @@ -16,8 +16,8 @@ {% endblock %} {% block commonjs %} -{{ render_bundle('app', attrs='nonce="%s"' % (csp_nonce,)) }} -{{ render_bundle('katex', attrs='nonce="%s"' % (csp_nonce,)) }} +{{ bundle('app') }} +{{ bundle('katex') }} {% endblock %} {% block customhead %} diff --git a/templates/zerver/apps.html b/templates/zerver/apps.html index 6476654362..6dbbc63298 100644 --- a/templates/zerver/apps.html +++ b/templates/zerver/apps.html @@ -5,7 +5,7 @@ -{{ render_bundle('landing-page') }} +{{ bundle('landing-page') }} {% endblock %} {% block portico_content %} diff --git a/templates/zerver/archive/index.html b/templates/zerver/archive/index.html index eca2b98da3..7d7417102d 100644 --- a/templates/zerver/archive/index.html +++ b/templates/zerver/archive/index.html @@ -11,11 +11,11 @@ } - {{ render_bundle('translations', attrs='nonce="%s"' % (csp_nonce,)) }} - {{ render_bundle('katex', attrs='nonce="%s"' % (csp_nonce,)) }} - {{ render_bundle('portico') }} - {{ render_bundle('archive') }} - {{ render_bundle('archive-styles') }} + {{ bundle('translations') }} + {{ bundle('katex') }} + {{ bundle('portico') }} + {{ bundle('archive') }} + {{ bundle('archive-styles') }} {% endblock %} diff --git a/templates/zerver/atlassian.html b/templates/zerver/atlassian.html index 6bd2963faf..736c2fa6be 100644 --- a/templates/zerver/atlassian.html +++ b/templates/zerver/atlassian.html @@ -6,7 +6,7 @@ {% block customhead %} -{{ render_bundle('landing-page') }} +{{ bundle('landing-page') }} {% endblock %} diff --git a/templates/zerver/base.html b/templates/zerver/base.html index 8ee48cbfdf..4d5e8a6ba0 100644 --- a/templates/zerver/base.html +++ b/templates/zerver/base.html @@ -26,11 +26,16 @@ var page_params = {debug_mode: false}; {% endblock %} + + {% macro bundle(name) %} + {{ render_bundle(name, attrs='nonce="%s"' % (csp_nonce,) if csp_nonce else '') }} + {% endmacro %} + {% block commonjs %} - {{ render_bundle('common', attrs='nonce="%s"' % (csp_nonce,)) }} + {{ bundle('common') }} {% endblock %} {% block customhead %} {% endblock %} diff --git a/templates/zerver/dev_login.html b/templates/zerver/dev_login.html index c8f7dfea15..1f8703d1b5 100644 --- a/templates/zerver/dev_login.html +++ b/templates/zerver/dev_login.html @@ -2,7 +2,7 @@ {# Login page. #} {% block portico_content %} -{{ render_bundle('dev-login') }} +{{ bundle('dev-login') }}
diff --git a/templates/zerver/digest_base.html b/templates/zerver/digest_base.html index a74bcf85f8..9acf1774b7 100644 --- a/templates/zerver/digest_base.html +++ b/templates/zerver/digest_base.html @@ -1,7 +1,7 @@ {% extends "zerver/base.html" %} {% block porticocustomhead %} -{{ render_bundle('portico') }} +{{ bundle('portico') }} {% endblock %} {% block content %} diff --git a/templates/zerver/documentation_main.html b/templates/zerver/documentation_main.html index 4b79afdb34..55a99ae60b 100644 --- a/templates/zerver/documentation_main.html +++ b/templates/zerver/documentation_main.html @@ -28,5 +28,5 @@
-{{ render_bundle("help") }} +{{ bundle("help") }} {% endblock %} diff --git a/templates/zerver/email_log.html b/templates/zerver/email_log.html index 3c4226e06d..f29526c9ac 100644 --- a/templates/zerver/email_log.html +++ b/templates/zerver/email_log.html @@ -1,6 +1,6 @@ {% extends "zerver/base.html" %} {% block content %} -{{ render_bundle('email-log') }} +{{ bundle('email-log') }}
diff --git a/templates/zerver/features.html b/templates/zerver/features.html index a5ea1a5879..55711eb1bd 100644 --- a/templates/zerver/features.html +++ b/templates/zerver/features.html @@ -4,7 +4,7 @@ {% set OPEN_GRAPH_DESCRIPTION = 'First class threading on top of everything you could want from real-time chat.' %} {% block customhead %} -{{ render_bundle('landing-page') }} +{{ bundle('landing-page') }} {% endblock %} {% block portico_content %} diff --git a/templates/zerver/for-companies.html b/templates/zerver/for-companies.html index 5de6e544d4..c17aab8f84 100644 --- a/templates/zerver/for-companies.html +++ b/templates/zerver/for-companies.html @@ -6,7 +6,7 @@ {% block customhead %} -{{ render_bundle('landing-page') }} +{{ bundle('landing-page') }} {% endblock %} diff --git a/templates/zerver/for-mystery-hunt.html b/templates/zerver/for-mystery-hunt.html index 1eb10670e2..d6bfe2d551 100644 --- a/templates/zerver/for-mystery-hunt.html +++ b/templates/zerver/for-mystery-hunt.html @@ -6,7 +6,7 @@ {% block customhead %} -{{ render_bundle('landing-page') }} +{{ bundle('landing-page') }} {% endblock %} diff --git a/templates/zerver/for-open-source.html b/templates/zerver/for-open-source.html index 6a571bbc2f..4e19b42e0d 100644 --- a/templates/zerver/for-open-source.html +++ b/templates/zerver/for-open-source.html @@ -9,7 +9,7 @@ {% block customhead %} -{{ render_bundle('landing-page') }} +{{ bundle('landing-page') }} {% endblock %} {% block portico_content %} diff --git a/templates/zerver/for-working-groups-and-communities.html b/templates/zerver/for-working-groups-and-communities.html index c99b03853a..1bd5fa22e6 100644 --- a/templates/zerver/for-working-groups-and-communities.html +++ b/templates/zerver/for-working-groups-and-communities.html @@ -6,7 +6,7 @@ {% block customhead %} -{{ render_bundle('landing-page') }} +{{ bundle('landing-page') }} {% endblock %} diff --git a/templates/zerver/hello.html b/templates/zerver/hello.html index f6825663e5..4d5fd0aa42 100644 --- a/templates/zerver/hello.html +++ b/templates/zerver/hello.html @@ -5,7 +5,7 @@ -{{ render_bundle('landing-page') }} +{{ bundle('landing-page') }}