templates: Use just one webpack entry point per page.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2019-10-22 22:46:34 -07:00 committed by Tim Abbott
parent f245fcf408
commit fda70a5458
40 changed files with 125 additions and 140 deletions

View File

@ -1,4 +1,5 @@
{% extends "zerver/base.html" %}
{% set entrypoint = "activity" %}
{# User Activity. #}
@ -7,11 +8,6 @@
{% endblock %}
{% block customhead %}
{{ super() }}
{{ bundle('activity') }}
{% endblock %}
{% block content %}
{% if not is_home %}

View File

@ -1,15 +1,9 @@
{% extends "zerver/base.html" %}
{% block customhead %}
{{ bundle('portico') }}
{% endblock %}
{% set entrypoint = "stats" %}
{% block content %}
<div class="app portico-page">
{{ bundle('translations') }}
{{ bundle('stats') }}
<div class="page-content">
<div id="id_stats_errors" class="alert alert-error"></div>
<div class="center-charts">

View File

@ -1,4 +1,5 @@
{% extends "zerver/base.html" %}
{% set entrypoint = "support" %}
{# User Activity. #}
@ -7,12 +8,6 @@
{% endblock %}
{% block customhead %}
{{ super() }}
{{ bundle('activity') }}
{{ bundle('support') }}
{% endblock %}
{% block content %}
<div class="container">
<br>

View File

@ -1,9 +1,5 @@
{% extends "zerver/base.html" %}
{% block customhead %}
{{ super() }}
{{ bundle('confirm-preregistrationuser') }}
{% endblock %}
{% set entrypoint = "confirm-preregistrationuser" %}
{% block content %}

View File

@ -1,9 +1,8 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "billing" %}
{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ bundle('landing-page') }}
{{ bundle('billing') }}
<script src="https://checkout.stripe.com/checkout.js"></script>
{% endblock %}
@ -13,7 +12,6 @@
{% include 'zerver/billing_nav.html' %}
{{ bundle('translations') }}
<div class="portico-landing billing-upgrade-page">
<div class="hero small-hero"></div>

View File

@ -1,4 +1,5 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "landing-page" %}
{% block title %}
<title>Zulip jobs</title>
@ -6,7 +7,6 @@
{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ bundle('landing-page') }}
{% endblock %}
{% block portico_content %}

View File

@ -1,9 +1,8 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "upgrade" %}
{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ bundle('landing-page') }}
{{ bundle('upgrade') }}
<script src="https://checkout.stripe.com/checkout.js"></script>
{% endblock %}
@ -13,8 +12,6 @@
{% include 'zerver/billing_nav.html' %}
{{ bundle('translations') }}
<div class="portico-landing billing-upgrade-page">
<div class="hero small-hero"></div>

View File

@ -1,4 +1,5 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "landing-page" %}
{% block title %}
<title>Zulip zephyr</title>
@ -6,7 +7,6 @@
{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ bundle('landing-page') }}
{% endblock %}
{% block portico_content %}

View File

@ -1,4 +1,5 @@
{% extends "zerver/base.html" %}
{% set entrypoint = "app" %}
{# The app itself. #}
{# Includes some other templates as tabs. #}
@ -6,11 +7,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
{% endblock %}
{% block commonjs %}
{{ bundle('app') }}
{{ bundle('katex') }}
{% endblock %}
{% block customhead %}
<meta name="apple-mobile-web-app-capable" content="yes">
<link href="/static/images/logo/apple-touch-icon-precomposed.png" rel="apple-touch-icon-precomposed">

View File

@ -1,11 +1,11 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "landing-page" %}
{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style media="screen">
.app.portico-page { padding-bottom: 0px; }
</style>
{{ bundle('landing-page') }}
{% endblock %}
{% block portico_content %}

View File

@ -1,4 +1,5 @@
{% extends "zerver/base.html" %}
{% set entrypoint = "archive" %}
{% block customhead %}
<link id="emoji-spritesheet" href="/static/generated/emoji/google-sprite.css" rel="stylesheet" type="text/css">
@ -10,13 +11,6 @@
width: auto;
}
</style>
{{ bundle('translations') }}
{{ bundle('katex') }}
{{ bundle('portico') }}
{{ bundle('archive') }}
{{ bundle('archive-styles') }}
{% endblock %}
{% block content %}

View File

@ -1,4 +1,5 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "landing-page" %}
{% block title %}
<title>Migrating from HipChat and Stride</title>
@ -6,8 +7,6 @@
{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ bundle('landing-page') }}
{% endblock %}
{% block portico_content %}

View File

@ -20,25 +20,13 @@
{% include 'zerver/meta_tags.html' %}
{% endif %}
{% macro bundle(name) %}
{{ render_entrypoint(name, 'css', attrs='nonce="%s"' % (csp_nonce,) if csp_nonce else '') }}
{{ render_entrypoint(name, 'js', attrs='defer nonce="%s"' % (csp_nonce,) if csp_nonce else 'defer') }}
{% endmacro %}
<!-- This is a temporary block to enable webpack transition
This allows pages requiring common files via webpack to override
this block -->
{% block commonjs %}
{{ bundle('common') }}
{% block webpack %}
{{ render_entrypoint(entrypoint, 'css', attrs='nonce="%s"' % (csp_nonce,) if csp_nonce else '') }}
{{ render_entrypoint(entrypoint, 'js', attrs='defer nonce="%s"' % (csp_nonce,) if csp_nonce else 'defer') }}
{% endblock %}
{% block customhead %}
{% endblock %}
{# this is required because we want to put a custom head in
`zerver/portico.html` that isn't overwritten like the
`customhead` #}
{% block porticocustomhead %}
{% endblock %}
</head>
<body {% if night_mode %}class="night-mode"{% endif %}>
@ -49,3 +37,5 @@
</body>
</html>
{% set entrypoint = entrypoint|default("common") %}

View File

@ -1,8 +1,8 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "dev-login" %}
{# Login page. #}
{% block portico_content %}
{{ bundle('dev-login') }}
<!-- The following empty tag has unique data-page-id so that this
page can be easily identified in it's respective JavaScript file -->
<div data-page-id="dev-login"></div>

View File

@ -1,8 +1,5 @@
{% extends "zerver/base.html" %}
{% block porticocustomhead %}
{{ bundle('portico') }}
{% endblock %}
{% set entrypoint = "digest" %}
{% block content %}
<body>

View File

@ -1,4 +1,5 @@
{% extends "zerver/portico-help.html" %}
{% set entrypoint = "help" %}
{# Zulip User and API Documentation. #}
@ -27,6 +28,4 @@
</div>
</div>
</div>
{{ bundle("help") }}
{% endblock %}

View File

@ -1,6 +1,6 @@
{% extends "zerver/base.html" %}
{% set entrypoint = "email-log" %}
{% block content %}
{{ bundle('email-log') }}
<div class="container">
<div style="position: fixed">
<div class="alert">

View File

@ -1,12 +1,9 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "landing-page" %}
{% set OPEN_GRAPH_TITLE = 'Zulip Features' %}
{% set OPEN_GRAPH_DESCRIPTION = 'First class threading on top of everything you could want from real-time chat.' %}
{% block customhead %}
{{ bundle('landing-page') }}
{% endblock %}
{% block portico_content %}
{% include 'zerver/landing_nav.html' %}

View File

@ -1,4 +1,5 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "landing-page" %}
{% block title %}
<title>Zulip: the best group chat for companies</title>
@ -6,8 +7,6 @@
{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ bundle('landing-page') }}
{% endblock %}
{% block portico_content %}

View File

@ -1,4 +1,5 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "landing-page" %}
{% block title %}
<title>Zephyr reloaded</title>
@ -6,8 +7,6 @@
{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ bundle('landing-page') }}
{% endblock %}
{% block portico_content %}

View File

@ -1,4 +1,5 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "landing-page" %}
{% set OPEN_GRAPH_TITLE = 'Modern chat for open source' %}
{% set OPEN_GRAPH_DESCRIPTION = 'No message limits, rich moderation features, markdown support, and a conversation model that scales to thousands of users.' %}
@ -9,7 +10,6 @@
{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ bundle('landing-page') }}
{% endblock %}
{% block portico_content %}

View File

@ -1,4 +1,5 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "landing-page" %}
{% block title %}
<title>Zulip: the best group chat for working groups and communities</title>
@ -6,8 +7,6 @@
{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ bundle('landing-page') }}
{% endblock %}
{% block portico_content %}

View File

@ -1,11 +1,11 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "landing-page" %}
{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap 2.3.2-->
<script src="https://stackpath.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js" defer></script>
{{ bundle('landing-page') }}
<style>
.portico-page {
padding-bottom: 0px;

View File

@ -1,4 +1,5 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "landing-page" %}
{% block title %}
<title>Zulip history</title>
@ -6,8 +7,6 @@
{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ bundle('landing-page') }}
{% endblock %}
{% block portico_content %}

View File

@ -1,11 +1,9 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "integrations-dev-panel" %}
{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ bundle('integrations-dev-panel') }}
{{ bundle('portico') }}
{% endblock %}

View File

@ -1,8 +1,8 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "integrations" %}
{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ bundle('integrations') }}
{% endblock %}
{% block hello_page_container %} hello-main{% endblock %}

View File

@ -1,11 +1,7 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "signup" %}
{# Login page. #}
{% block customhead %}
{{ super() }}
{{ bundle('signup') }}
{% endblock %}
{% block portico_content %}
<!-- The following empty tag has unique data-page-id so that this

View File

@ -1,8 +1,8 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "landing-page" %}
{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ bundle('landing-page') }}
{% endblock %}
{% block portico_content %}

View File

@ -1,4 +1,5 @@
{% extends "zerver/base.html" %}
{% set entrypoint = entrypoint|default("portico") %}
{# A base template for stuff like login, register, etc.
@ -6,11 +7,6 @@
hence the name.
#}
{% block porticocustomhead %}
{{ bundle('translations') }}
{{ bundle('portico') }}
{% endblock %}
{% block content %}
<div class="portico-container" data-platform="{{ platform }}">
<div class="portico-wrap">

View File

@ -1,8 +1,4 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = entrypoint|default("signup") %}
{# Portico page with signup code #}
{% block customhead %}
{{ super() }}
{{ bundle('signup') }}
{% endblock %}

View File

@ -1,4 +1,5 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "landing-page" %}
{% block title %}
<title>Zulip: the best group chat for open source projects</title>
@ -6,7 +7,6 @@
{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ bundle('landing-page') }}
{% endblock %}
{% block portico_content %}

View File

@ -1,9 +1,8 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "landing-page" %}
{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ bundle('landing-page') }}
{% endblock %}
{% block portico_content %}

View File

@ -1,4 +1,5 @@
{% extends "zerver/portico_signup.html" %}
{% set entrypoint = "register" %}
{#
Gather other user information, after having confirmed
their email address.
@ -6,12 +7,6 @@ their email address.
Form is validated both client-side using jquery-validate (see signup.js) and server-side.
#}
{% block customhead %}
{{ super() }}
{{ bundle('zxcvbn') }}
{{ bundle('translations') }}
{% endblock %}
{% block portico_content %}
<div class="register-account flex full-page">
<div class="center-block new-style" style="padding: 20px 0px">

View File

@ -1,8 +1,5 @@
{% extends "zerver/portico_signup.html" %}
{% block customhead %}
{{ super() }}
{{ bundle('zxcvbn') }}
{% endblock %}
{% set entrypoint = "register" %}
{% block portico_content %}

View File

@ -1,4 +1,5 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "landing-page" %}
{% block title %}
<title>Zulip Security</title>
@ -6,8 +7,6 @@
{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ bundle('landing-page') }}
{% endblock %}
{% block portico_content %}

View File

@ -1,13 +1,10 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "landing-page" %}
{% block title %}
<title>Zulip: the best group chat for open source projects</title>
{% endblock %}
{% block customhead %}
{{ bundle('landing-page') }}
{% endblock %}
{% block portico_content %}
{% include 'zerver/landing_nav.html' %}

View File

@ -1,11 +1,10 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "landing-page" %}
{# Terms of Service. #}
{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ bundle('landing-page') }}
{% endblock %}
{% block portico_content %}

View File

@ -1,4 +1,5 @@
{% extends "zerver/portico.html" %}
{% set entrypoint = "landing-page" %}
{% set OPEN_GRAPH_TITLE = 'Team chat with first-class threading' %}
{% set OPEN_GRAPH_DESCRIPTION = 'Most team chats are overwhelming to keep up with. Zulip takes a different approach.' %}
@ -9,8 +10,6 @@
{% block customhead %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ bundle('landing-page') }}
{% endblock %}
{% block portico_content %}

View File

@ -1,10 +1,16 @@
{
"activity": [
"./static/js/bundles/common.js",
"sorttable/sorttable.js",
"./static/js/analytics/activity.js",
"./static/styles/portico/activity.scss"
],
"archive": [
"./static/js/bundles/common.js",
"./static/js/translations.js",
"katex/dist/katex.min.js",
"./static/js/portico/header.js",
"./static/styles/portico/portico-styles.scss",
"xdate/src/xdate.js",
"handlebars/dist/cjs/handlebars.runtime.js",
"./static/js/archive.js",
@ -13,9 +19,19 @@
"./static/js/timerender.js",
"./static/js/templates.js",
"./static/js/stream_color.js",
"./static/js/scroll_bar.js"
"./static/js/scroll_bar.js",
"katex/dist/katex.css",
"./static/styles/rendered_markdown.scss",
"./static/styles/zulip.scss",
"./static/styles/portico/archive.scss"
],
"billing": [
"./static/js/bundles/common.js",
"./static/js/translations.js",
"./static/js/portico/header.js",
"./static/styles/portico/portico-styles.scss",
"./static/js/portico/landing-page.js",
"./static/styles/portico/landing-page.scss",
"./static/js/billing/helpers.js",
"./static/js/billing/billing.js",
"handlebars/dist/cjs/handlebars.runtime.js",
@ -24,6 +40,12 @@
"./static/styles/portico/billing.scss"
],
"upgrade": [
"./static/js/bundles/common.js",
"./static/js/translations.js",
"./static/js/portico/header.js",
"./static/styles/portico/portico-styles.scss",
"./static/js/portico/landing-page.js",
"./static/styles/portico/landing-page.scss",
"./static/js/billing/helpers.js",
"./static/js/billing/upgrade.js",
"handlebars/dist/cjs/handlebars.runtime.js",
@ -32,6 +54,8 @@
"./static/styles/portico/billing.scss"
],
"portico": [
"./static/js/bundles/common.js",
"./static/js/translations.js",
"./static/js/portico/header.js",
"./static/styles/portico/portico-styles.scss"
],
@ -44,54 +68,98 @@
"./static/js/bundles/common.js"
],
"help": [
"./static/js/bundles/common.js",
"./static/js/translations.js",
"./static/js/portico/header.js",
"./static/styles/portico/portico-styles.scss",
"simplebar/dist/simplebar.css",
"simplebar/dist/simplebar.js",
"./static/js/portico/help.js",
"./static/js/portico/tabbed-instructions.js"
],
"katex": "katex/dist/katex.min.js",
"landing-page": [
"./static/js/bundles/common.js",
"./static/js/translations.js",
"./static/js/portico/header.js",
"./static/styles/portico/portico-styles.scss",
"./static/js/portico/landing-page.js",
"./static/styles/portico/landing-page.scss"
],
"integrations": [
"./static/js/bundles/common.js",
"./static/js/translations.js",
"./static/js/portico/header.js",
"./static/styles/portico/portico-styles.scss",
"./static/js/portico/integrations.js",
"./static/styles/portico/landing-page.scss",
"./static/styles/portico/integrations.scss"
],
"signup": [
"./static/js/bundles/common.js",
"./static/js/translations.js",
"./static/js/portico/header.js",
"./static/styles/portico/portico-styles.scss",
"jquery-validation/dist/jquery.validate.min.js",
"./static/js/portico/signup.js"
],
"register": [
"./static/js/bundles/common.js",
"./static/js/translations.js",
"./static/js/portico/header.js",
"./static/styles/portico/portico-styles.scss",
"jquery-validation/dist/jquery.validate.min.js",
"./static/js/portico/signup.js",
"zxcvbn/dist/zxcvbn.js"
],
"confirm-preregistrationuser": [
"./static/js/bundles/common.js",
"./static/js/portico/confirm-preregistrationuser.js"
],
"support": [
"./static/js/bundles/common.js",
"sorttable/sorttable.js",
"./static/js/analytics/activity.js",
"./static/styles/portico/activity.scss",
"./static/js/analytics/support.js",
"./static/styles/app_components.scss"
],
"dev-login": "./static/js/portico/dev-login.js",
"dev-login": [
"./static/js/bundles/common.js",
"./static/js/translations.js",
"./static/js/portico/header.js",
"./static/styles/portico/portico-styles.scss",
"./static/js/portico/dev-login.js"
],
"integrations-dev-panel": [
"./static/js/bundles/common.js",
"./static/js/translations.js",
"./static/js/portico/header.js",
"./static/styles/portico/portico-styles.scss",
"./static/js/portico/integrations_dev_panel.js",
"./static/styles/portico/integrations_dev_panel.css",
"./static/js/channel.js"
],
"email-log": [
"./static/js/bundles/common.js",
"./static/js/portico/email_log.js",
"./static/js/channel.js"
],
"stats": [
"./static/js/bundles/common.js",
"./static/js/portico/header.js",
"./static/styles/portico/portico-styles.scss",
"./static/js/translations.js",
"./static/styles/portico/stats.scss",
"./static/js/stats/stats.js",
"plotly.js/dist/plotly-basic.min.js"
],
"translations": "./static/js/translations.js",
"zxcvbn": "zxcvbn/dist/zxcvbn.js",
"app": "./static/js/bundles/app.js",
"archive-styles": [
"katex/dist/katex.css",
"./static/styles/rendered_markdown.scss",
"./static/styles/zulip.scss",
"./static/styles/portico/archive.scss"
"app": [
"./static/js/bundles/app.js",
"katex/dist/katex.min.js"
],
"digest": [
"./static/js/bundles/common.js",
"./static/js/portico/header.js",
"./static/styles/portico/portico-styles.scss"
]
}

View File

@ -238,7 +238,9 @@ export default (env?: string): webpack.Configuration[] => {
if (!production) {
// Out JS debugging tools
config.entry['common'].push('./static/js/debug.js'); // eslint-disable-line dot-notation
for (const name of Object.keys(config.entry)) {
config.entry[name].push('./static/js/debug.js');
}
config.devServer = {
clientLogLevel: "error",
stats: "errors-only",