mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Moving JS assets to bottom of the page for faster loadtimes.
This commit is contained in:
parent
33ad0ea5f6
commit
e2e0d1e09d
5 changed files with 38 additions and 44 deletions
4
fabfile.py
vendored
4
fabfile.py
vendored
|
@ -71,7 +71,7 @@ def pull():
|
|||
run('git pull')
|
||||
|
||||
def pre_deploy():
|
||||
compress_assets()
|
||||
compress_assets(bundle=True)
|
||||
|
||||
def post_deploy():
|
||||
cleanup_assets()
|
||||
|
@ -149,7 +149,7 @@ def kill_celery():
|
|||
with cd(env.NEWSBLUR_PATH):
|
||||
run('ps aux | grep celeryd | egrep -v grep | awk \'{print $2}\' | sudo xargs kill -9')
|
||||
|
||||
def compress_assets():
|
||||
def compress_assets(bundle=False):
|
||||
local('jammit -c assets.yml --base-url http://www.newsblur.com --output static')
|
||||
local('tar -czf static.tgz static/*')
|
||||
|
||||
|
|
|
@ -39,10 +39,12 @@ if '/utils' not in ' '.join(sys.path):
|
|||
sys.path.append(UTILS_ROOT)
|
||||
if '/vendor' not in ' '.join(sys.path):
|
||||
sys.path.append(VENDOR_ROOT)
|
||||
|
||||
# ===================
|
||||
# = Global Settings =
|
||||
# ===================
|
||||
|
||||
DEBUG = False
|
||||
TEST_DEBUG = False
|
||||
SEND_BROKEN_LINK_EMAILS = False
|
||||
MANAGERS = ADMINS
|
||||
|
@ -60,7 +62,7 @@ ADMIN_MEDIA_PREFIX = '/media/admin/'
|
|||
SECRET_KEY = 'YOUR_SECRET_KEY'
|
||||
EMAIL_BACKEND = 'django_ses.SESBackend'
|
||||
CIPHER_USERNAMES = False
|
||||
|
||||
DEBUG_ASSETS = DEBUG
|
||||
|
||||
# ===============
|
||||
# = Enviornment =
|
||||
|
|
|
@ -62,17 +62,6 @@
|
|||
</script>
|
||||
|
||||
{% include_stylesheets "common" %}
|
||||
{% block head_js %}
|
||||
{% include_javascripts "common" %}
|
||||
{% endblock head_js %}
|
||||
{% block extra_head_js %}
|
||||
{% endblock extra_head_js %}
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$.extend(NEWSBLUR.Preferences, {% if user_profile.preferences %}{{ user_profile.preferences|safe }}{% else %}{}{% endif %});
|
||||
$.extend(NEWSBLUR.Preferences['view_settings'], {% if user_profile.view_settings %}{{ user_profile.view_settings|safe }}{% else %}{}{% endif %});
|
||||
$.extend(NEWSBLUR.Preferences['collapsed_folders'], {% if user_profile.collapsed_folders %}{{ user_profile.collapsed_folders|safe }}{% else %}[]{% endif %});
|
||||
</script>
|
||||
|
||||
{% if not debug %}
|
||||
<script type="text/javascript">
|
||||
|
@ -121,19 +110,16 @@
|
|||
|
||||
{% block content %}{% endblock %}
|
||||
|
||||
{% if not debug %}
|
||||
<!-- Start Quantcast tag -->
|
||||
<script type="text/javascript">
|
||||
_qoptions={
|
||||
qacct:"p-0dE65XaLY51Og"
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="http://edge.quantserve.com/quant.js"></script>
|
||||
<noscript>
|
||||
<img src="http://pixel.quantserve.com/pixel/p-0dE65XaLY51Og.gif" style="display: none;" border="0" height="1" width="1" alt="Quantcast"/>
|
||||
</noscript>
|
||||
<!-- End Quantcast tag -->
|
||||
{% endif %}
|
||||
|
||||
{% block head_js %}
|
||||
{% include_javascripts "common" %}
|
||||
{% endblock head_js %}
|
||||
{% block extra_head_js %}
|
||||
{% endblock extra_head_js %}
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$.extend(NEWSBLUR.Preferences, {% if user_profile.preferences %}{{ user_profile.preferences|safe }}{% else %}{}{% endif %});
|
||||
$.extend(NEWSBLUR.Preferences['view_settings'], {% if user_profile.view_settings %}{{ user_profile.view_settings|safe }}{% else %}{}{% endif %});
|
||||
$.extend(NEWSBLUR.Preferences['collapsed_folders'], {% if user_profile.collapsed_folders %}{{ user_profile.collapsed_folders|safe }}{% else %}[]{% endif %});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -2,15 +2,29 @@
|
|||
|
||||
{% load typogrify_tags recommendations_tags utils_tags statistics_tags %}
|
||||
|
||||
{% block extra_head_js %}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
NEWSBLUR.reader = new NEWSBLUR.Reader();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
{% if user.is_staff %}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#add-feature-button').click(function(e) {
|
||||
e.preventDefault();
|
||||
$('#add-feature-form').fadeIn(500);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
NEWSBLUR.reader = new NEWSBLUR.Reader();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<h1 class="NB-splash-heading">NewsBlur</h1>
|
||||
<h2 class="NB-splash-heading">- A visual feed reader with intelligence.</h2>
|
||||
|
@ -28,14 +42,6 @@ $(document).ready(function() {
|
|||
<div class="NB-features-add">
|
||||
<a href="#" id="add-feature-button" class="NB-splash-link">Add</a>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#add-feature-button').click(function(e) {
|
||||
e.preventDefault();
|
||||
$('#add-feature-form').fadeIn(500);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
<div class="NB-spinner NB-left"></div>
|
||||
<a href="#" class="NB-module-direction NB-module-next-page NB-javascript"></a>
|
||||
|
|
|
@ -36,7 +36,7 @@ class JammitAssets:
|
|||
`use_compressed_assets` profile setting.
|
||||
"""
|
||||
tags = []
|
||||
if not settings.DEBUG:
|
||||
if not getattr(settings, 'DEBUG_ASSETS', settings.DEBUG):
|
||||
if asset_type == 'javascripts':
|
||||
asset_type_ext = 'js'
|
||||
elif asset_type == 'stylesheets':
|
||||
|
|
Loading…
Add table
Reference in a new issue