Compress and minify JS and CSS

This commit is contained in:
lesley 2020-06-17 16:15:46 -05:00
Родитель 843c7206da
Коммит 74a06c33eb
4 изменённых файлов: 30 добавлений и 11 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -7,4 +7,5 @@ env/
__pycache__
web-ext-artifacts/
static/downloads
static/CACHE
htmlcov

Просмотреть файл

@ -123,6 +123,7 @@ SERVE_ADDON = config('SERVE_ADDON', None)
# Application definition
INSTALLED_APPS = [
'compressor',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
@ -276,12 +277,23 @@ USE_TZ = True
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]
STATICFILES_FINDERS = [
'compressor.finders.CompressorFinder',
]
COMPRESS_CSS_FILTERS = [
'compressor.filters.css_default.CssAbsoluteFilter',
'compressor.filters.cssmin.rCSSMinFilter',
]
COMPRESS_ENABLED = True
SITE_ID = 1
AUTHENTICATION_BACKENDS = (

Просмотреть файл

@ -1,3 +1,4 @@
{% load compress %}
{% load socialaccount %}
{% load static %}
@ -7,12 +8,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<title>Firefox Relay</title>
<link rel="stylesheet" href="{% static 'css/style.css' %}">
<link rel="stylesheet" href="{% static 'css/inter-ui.css' %}">
<link rel="stylesheet" href="{% static 'css/metropolis.css' %}">
<link rel="stylesheet" href="{% static 'css/fx-bento.css' %}">
<link rel="stylesheet" href="{% static 'css/glocal-menu.css' %}">
<link rel="shortcut icon" href="{% static 'images/favicon.ico' %}">
{% compress css %}
<link rel="stylesheet" href="{% static 'css/style.css' %}">
<link rel="stylesheet" href="{% static 'css/inter-ui.css' %}">
<link rel="stylesheet" href="{% static 'css/metropolis.css' %}">
<link rel="stylesheet" href="{% static 'css/fx-bento.css' %}">
<link rel="stylesheet" href="{% static 'css/glocal-menu.css' %}">
<link rel="shortcut icon" href="{% static 'images/favicon.ico' %}">
{% endcompress %}
</head>
<body data-fxa-settings-url="{{ settings.FXA_SETTINGS_URL }}" data-site-origin="{{ settings.SITE_ORIGIN }}">
<firefox-private-relay-addon data-addon-installed="false"></firefox-private-relay-addon>
@ -22,9 +25,11 @@
{% endblock %}
{% include "includes/footer.html" %}
<script type="text/javascript" src="{% static 'js/clipboard.min.js' %}" charset="utf-8"></script>
<script src="{% static 'js/fx-bento.js' %}"></script>
<script src="{% static 'js/app.js' %}"></script>
<script src="{% static 'js/analytics.js' %}"></script>
{% compress js %}
<script type="text/javascript" src="{% static 'js/clipboard.min.js' %}" charset="utf-8"></script>
<script src="{% static 'js/fx-bento.js' %}"></script>
<script src="{% static 'js/app.js' %}"></script>
<script src="{% static 'js/analytics.js' %}"></script>
{% endcompress %}
</body>
</html>

Просмотреть файл

@ -2,6 +2,7 @@ boto3==1.13.9
Django==2.2.13
dj-database-url==0.5.0
django-allauth==0.39.1
django-compressor==2.4
django-csp==3.5
django-debug-toolbar==2.2
django-referrer-policy==1.0