Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frontend speed improvements - cuts landing page load time by 55% and DOMready time by 35% #4826

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ app/assets/v2/js/lib/highlight.js
app/assets/v2/js/lib/tooltip.js
app/assets/v2/js/lib/tweenlite.js
app/assets/v2/js/abi.js
app/assets/v2/js/lib/vue.js

app/assets/onepager/js/confetti.js

Expand Down
18 changes: 18 additions & 0 deletions app/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
env.read_env(str(root.path('app/.env'))) # reading .env file

DEBUG = env.bool('DEBUG', default=True)
TEMPLATE_DEBUG = env.bool('TEMPLATE_DEBUG', default=False)
ENV = env('ENV', default='local')
DEBUG_ENVS = env.list('DEBUG_ENVS', default=['local', 'stage', 'test'])
IS_DEBUG_ENV = ENV in DEBUG_ENVS
Expand Down Expand Up @@ -113,6 +114,8 @@
'revenue',
'event_ethdenver2019',
'inbox',
"compressor",
'statici18n',
]

MIDDLEWARE = [
Expand Down Expand Up @@ -150,6 +153,7 @@
'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages',
'app.context.preprocess', 'social_django.context_processors.backends',
'social_django.context_processors.login_redirect',
'django.template.context_processors.i18n',
],
},
}]
Expand Down Expand Up @@ -346,6 +350,13 @@
STATICFILES_LOCATION = env.str('STATICFILES_LOCATION', default='static')
MEDIAFILES_LOCATION = env.str('MEDIAFILES_LOCATION', default='media')

STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# other finders..
'compressor.finders.CompressorFinder',
)

if ENV in ['prod', 'stage']:
DEFAULT_FILE_STORAGE = env('DEFAULT_FILE_STORAGE', default='app.static_storage.MediaFileStorage')
THUMBNAIL_DEFAULT_STORAGE = DEFAULT_FILE_STORAGE
Expand Down Expand Up @@ -672,6 +683,13 @@

STABLE_COINS = ['DAI', 'USDT', 'TUSD']

from datetime import date, timedelta
tenyrs = date.today() + timedelta(days=365*10)
# Expires 10 years in the future at 8PM GMT
AWS_HEADERS = {
'Expires': tenyrs.strftime('%a, %d %b %Y 20:00:00 GMT')
}

# Silk Profiling and Performance Monitoring
ENABLE_SILK = env.bool('ENABLE_SILK', default=False)
if ENABLE_SILK:
Expand Down
2 changes: 1 addition & 1 deletion app/assets/v2/css/profile.css
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ a:hover .avatar_edit .avatar_edit_text {
}

nav.navbar.navbar-dark{
background-image: url(/static/v2/images/header-bg.png);
background-color: #181143;
}


Binary file added app/assets/v2/images/home/bots.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/assets/v2/images/medium/1.png
Binary file not shown.
Binary file removed app/assets/v2/images/medium/2.png
Binary file not shown.
Binary file removed app/assets/v2/images/medium/3.png
Binary file not shown.
6 changes: 6 additions & 0 deletions app/assets/v2/js/lib/vue.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion app/bounty_requests/templates/bounty_request_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
{% endcomment %}
{% load i18n static %}
{% load i18n static compress %}
<!DOCTYPE html>
<html lang="en">
<head>
Expand Down Expand Up @@ -93,5 +93,7 @@ <h3>{% trans 'Bounty Request Received' %}</h3>
{% include 'shared/footer.html' %}
{% include 'shared/messages.html' %}
</body>
{% compress js %}
<script src="{% static "v2/js/pages/bounty_request_form.js" %}"></script>
{% endcompress %}
</html>
8 changes: 5 additions & 3 deletions app/dashboard/templates/board/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
along with this program. If not,see
<http://www.gnu.org/licenses/>.
{% endcomment %}
{% load i18n static add_url_schema avatar_tags %}
{% load i18n static add_url_schema avatar_tags compress %}

<!DOCTYPE html>
<html lang="en">
<head>
{% include 'shared/head.html' %}
{% include 'shared/cards.html' %}
{% compress css %}
<link rel="stylesheet" href={% static "v2/css/vue-loader.css" %} />

<link rel="stylesheet" href="{% static "v2/css/board.css" %}" />

{% endcompress %}
</head>
<body class="{{ active }} bg-lightblue g-font-muli" >
{% include 'shared/top_nav.html' with class='d-md-flex' %}
Expand All @@ -49,8 +49,10 @@
{% include 'shared/footer.html' %}
{% include 'shared/analytics.html' %}
{% include 'shared/footer_scripts.html' with slim=1 %}
{% compress js %}
<script src="{% static "v2/js/vue-components.js" %}"></script>
<script src="{% static "v2/js/board.js" %}"></script>
{% endcompress %}
<script>
$('body').bootstrapTooltip({
selector: '[data-toggle="tooltip"]'
Expand Down
6 changes: 5 additions & 1 deletion app/dashboard/templates/bounty/change.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
{% endcomment %}
{% load i18n static %}
{% load i18n static compress %}
<!DOCTYPE html>
<html lang="en">
<head>
{% include 'shared/head.html' %}
{% include 'shared/cards.html' %}
{% compress css %}
<link rel="stylesheet" href={% static "v2/css/submit_bounty.css" %}>
{% endcompress %}
</head>
<body class="interior submit_bounty g-font-muli">
{% include 'shared/tag_manager_2.html' %}
Expand Down Expand Up @@ -134,9 +136,11 @@ <h1 class="text-center title">{% trans "Change Bounty Details" %}</h1>
document.pk = {{ pk }};
document.result = {{ result|safe }};
</script>
{% compress js %}
<script src="{% static "v2/js/lib/jquery.validate.min.js" %}"></script>
<script src="{% static "v2/js/shared.js" %}"></script>
<script src="{% static "v2/js/amounts.js" %}"></script>
<script src="{% static "v2/js/user-search.js" %}"></script>
<script src="{% static "v2/js/pages/change_bounty.js" %}"></script>
{% endcompress %}
</html>
21 changes: 12 additions & 9 deletions app/dashboard/templates/bounty/details.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load i18n static %}
{% load i18n static compress %}
<!DOCTYPE html>
<html lang="en">

Expand All @@ -10,11 +10,13 @@
{% if canonical_url %}
<link rel="canonical" href="{{ canonical_url }}">
{% endif %}
{% compress css %}
<link rel="stylesheet" href="{% static "v2/css/lib/daterangepicker.css" %}">
<link rel="stylesheet" href="{% static "v2/css/lib/highlight_github.css" %}">
<link rel="stylesheet" href="{% static "v2/css/bounty.css" %}">
<link rel="stylesheet" href="{% static "v2/css/user_popover.css" %}">
<link rel="stylesheet" href="{% static "v2/css/tag.css" %}">
{% endcompress %}
</head>

<body class="interior {{active}} g-font-muli">
Expand Down Expand Up @@ -475,20 +477,14 @@ <h3>{{ noscript.keywords }}</h3>
{% endif %}
</script>

<script src="/dynamic/js/tokens_dynamic.js"></script>
{% compress js %}
<script src="{% static "v2/js/lib/highlight.js" %}"></script>
<script src="{% static "v2/js/lib/markdown-it.js" %}"></script>

<script src="{% static "v2/js/abi.js" %}"></script>
<script src="/dynamic/js/tokens_dynamic.js"></script>
<script src="{% static "v2/js/tokens.js" %}"></script>
<script src="{% static "v2/js/amounts.js" %}"></script>
<script src="{% static "v2/js/clipboard.js" %}"></script>
<script>
$('[data-toggle="popover"]').popover()
$("body").on("mouseover", "[data-username]", function(e) {
openContributorPopOver($(this).data("username"), $(this));
});
</script>
<script src="{% static "v2/js/lib/daterangepicker.min.js" %}"></script>
<script src="{% static "v2/js/pages/bounty_funder_payout_reminder.js" %}"></script>
<script src="{% static "v2/js/pages/bounty_share.js" %}"></script>
Expand All @@ -498,6 +494,13 @@ <h3>{{ noscript.keywords }}</h3>
<script src="{% static "v2/js/ipfs.js" %}"></script>
<script src="{% static "v2/js/user-search.js" %}"></script>
<script src="{% static "v2/js/waiting_room_entertainment.js" %}"></script>
{% endcompress %}
<script>
$('[data-toggle="popover"]').popover()
$("body").on("mouseover", "[data-username] img", function(e) {
openContributorPopOver($(this).parent().data("username"), $(this));
});
</script>
{% for message in messages %}
{% if message.tags == 'success'%}
<script>
Expand Down
15 changes: 13 additions & 2 deletions app/dashboard/templates/bounty/fulfill.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.

{% endcomment %}
{% load i18n static %}
{% load i18n static compress %}
<!DOCTYPE html>
<html lang="en">
<head>
{% include 'shared/head.html' %}
{% include 'shared/cards.html' %}
{% compress css %}
<link rel="stylesheet" href={% static "v2/css/submit_bounty.css" %}>
<link rel="stylesheet" href={% static "v2/css/rating.css" %} />
{% endcompress %}
</head>
<body class="interior {{active}} g-font-muli">
{% include 'shared/tag_manager_2.html' %}
Expand Down Expand Up @@ -100,18 +102,27 @@ <h1 class="text-center title">{% trans "Submit Work" %}</h1>
{% include 'shared/footer.html' %}
{% include 'shared/messages.html' %}
</body>

<!-- jQuery -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is already loaded in footer_scripts.js

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{% compress js %}


{% endcompress %}

<script>
$('[data-toggle="popover"]').popover()
$('[data-toggle="tooltip"]').bootstrapTooltip();
</script>
{% compress js %}
<script src="{% static "v2/js/pages/wallet_estimate.js" %}"></script>
<script src="{% static "v2/js/rating.js" %}"></script>
<script src="{% static "v2/js/abi.js" %}"></script>
<script src="/dynamic/js/tokens_dynamic.js"></script>
<script src="{% static "v2/js/tokens.js" %}"></script>
<script src="{% static "v2/js/pages/shared_bounty_mutation_estimate_gas.js" %}"></script>
<script src="{% static "v2/js/pages/fulfill_bounty.js" %}"></script>
<script src="{% static "v2/js/lib/ipfs-api.js" %}"></script>
<script src="{% static "v2/js/ipfs.js" %}"></script>
{% endcompress %}
<script src="/dynamic/js/tokens_dynamic.js"></script>

</html>
9 changes: 6 additions & 3 deletions app/dashboard/templates/bounty/fund.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
{% endcomment %}
{% load i18n static %}
{% load i18n static compress %}
<!DOCTYPE html>
<html lang="en">

Expand All @@ -23,8 +23,10 @@
{% include 'shared/cards.html' %}
<meta name="title" content="Create Funded Issue/Bounty | Gitcoin">
<meta name="description" content="Instructions for creating an issue and posting a bounty to Gitcoin so developers across the world can discover your bounty and start working on your issue.">
{% compress css %}
<link rel="stylesheet" href={% static "v2/css/lib/daterangepicker.css" %}>
<link rel="stylesheet" href={% static "v2/css/submit_bounty.css" %}>
{% endcompress %}
</head>

<body class="interior {{active}} g-font-muli" style="background-color: #FFFFFF;">
Expand Down Expand Up @@ -446,19 +448,20 @@ <h3 class="mt-3 mb-4 font-title-lg font-weight-semibold">
_alert({ message: 'This coupon has expired.' }, 'error');
{% endif %}
</script>
{% compress js %}
<script src="{% static "v2/js/lib/jquery.validate.min.js" %}"></script>
<script src="{% static "v2/js/shared.js" %}"></script>

<script src="{% static "v2/js/pages/wallet_estimate.js" %}"></script>
<script src="{% static "v2/js/lib/ipfs-api.js" %}"></script>
<script src="{% static "v2/js/ipfs.js" %}"></script>
<script src="{% static "v2/js/amounts.js" %}"></script>
<script src="{% static "v2/js/abi.js" %}"></script>
<script src="/dynamic/js/tokens_dynamic.js"></script>
<script src="{% static "v2/js/tokens.js" %}"></script>
<script src="{% static "v2/js/user-search.js" %}"></script>
<script src="{% static "v2/js/pages/shared_bounty_mutation_estimate_gas.js" %}"></script>
<script src="{% static "v2/js/lib/daterangepicker.min.js" %}"></script>
<script src="{% static "v2/js/pages/new_bounty.js" %}"></script>
{% endcompress %}
<script src="/dynamic/js/tokens_dynamic.js"></script>

</html>
8 changes: 6 additions & 2 deletions app/dashboard/templates/bounty/increase.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.

{% endcomment %}
{% load i18n static %}
{% load i18n static compress %}
<!DOCTYPE html>
<html lang="en">

Expand All @@ -27,7 +27,9 @@
max-width: 40rem;
}
</style>
{% compress css %}
<link rel="stylesheet" href={% static "v2/css/submit_bounty.css" %}>
{% endcompress %}
</head>

<body class="interior {{active}} g-font-muli">
Expand Down Expand Up @@ -173,6 +175,7 @@ <h5 class="font-title-lg mb-0">{% trans "Total"%} </h5>
document.FEE_PERCENTAGE = {{ FEE_PERCENTAGE }};
</script>

{% compress js %}
<script src="{% static "v2/js/pages/wallet_estimate.js" %}"></script>
<script src="{% static "v2/js/lib/ipfs-api.js" %}"></script>
<script src="{% static "v2/js/ipfs.js" %}"></script>
Expand All @@ -182,11 +185,12 @@ <h5 class="font-title-lg mb-0">{% trans "Total"%} </h5>
<script src="{% static "v2/js/ipfs.js" %}"></script>
<script src="{% static "v2/js/amounts.js" %}"></script>
<script src="{% static "v2/js/abi.js" %}"></script>
<script src="/dynamic/js/tokens_dynamic.js"></script>
<script src="{% static "v2/js/tokens.js" %}"></script>
<script src="{% static "v2/js/pages/shared_bounty_mutation_estimate_gas.js" %}"></script>
<script src="{% static "v2/js/pages/increase_bounty.js" %}"></script>
<script src="{% static "onepager/js/send.js" %}"></script>
{% endcompress %}
<script src="/dynamic/js/tokens_dynamic.js"></script>


</html>
6 changes: 4 additions & 2 deletions app/dashboard/templates/bounty/kill.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.

{% endcomment %}
{% load i18n static %}
{% load i18n static compress %}
<!DOCTYPE html>
<html lang="en">
<head>
Expand Down Expand Up @@ -152,11 +152,13 @@ <h6>{% trans "Reason" %}</h6>
{% include 'shared/messages.html' %}
</body>

<script src="/dynamic/js/tokens_dynamic.js"></script>
{% compress js %}
<script src="{% static "v2/js/pages/wallet_estimate.js" %}"></script>
<script src="{% static "v2/js/abi.js" %}"></script>
<script src="/dynamic/js/tokens_dynamic.js"></script>
<script src="{% static "v2/js/tokens.js" %}"></script>
<script src="{% static "v2/js/pages/shared_bounty_mutation_estimate_gas.js" %}"></script>
<script src="{% static "v2/js/pages/kill_bounty.js" %}"></script>
{% endcompress %}

</html>
8 changes: 6 additions & 2 deletions app/dashboard/templates/bounty/process_refund_request.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@

{% endcomment %}

{% load i18n static %}
{% load i18n static compress %}

{% compress css %}
{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/dashboard.css" %}">{% endblock %}

{% endcompress %}
{% block bodyclass %}{{ block.super }} dashboard{% endblock %}

{% block breadcrumbs %}{% endblock %}
Expand Down Expand Up @@ -156,9 +158,11 @@ <h6>Reject Refund Request:</h6>
function gettext(str){return str};
</script>
{% include 'shared/footer_scripts.html' %}
{% compress js %}
<script src="{% static "v2/js/abi.js" %}"></script>
<script src="/dynamic/js/tokens_dynamic.js"></script>
<script src="{% static "v2/js/tokens.js" %}"></script>
<script src="{% static "v2/js/metamask-approval.js" %}"></script>
<script src="{% static "v2/js/pages/process_refund_request.js" %}"></script>
{% endcompress %}
<script src="/dynamic/js/tokens_dynamic.js"></script>
{% endblock %}
Loading