Commit 82662f47 authored by alexandre's avatar alexandre

Added postcss and django compressor

Run from your app root:

npm install -save postcss postcss-cssnext postcss-cli postcss-import
parent 52b12ad6
......@@ -28,6 +28,8 @@ INSTALLED_APPS = [
'rest_framework',
'compressor',
'playground',
]
......@@ -95,10 +97,29 @@ USE_L10N = True
USE_TZ = True
# Django registration
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# other finders..
'compressor.finders.CompressorFinder',
)
# Django registration
ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value.
# Django Compressor setup
COMPRESS_PRECOMPILERS = (
('text/css', './node_modules/.bin/postcss {infile} --use postcss-cssnext --use postcss-import'),
)
COMPRESS_ENABLED = True
COMPRESS_CSS_FILTERS = [
'compressor.filters.css_default.CssAbsoluteFilter',
'compressor.filters.cssmin.CSSMinFilter'
]
try:
LOCAL_SETTINGS
......
{% load static %}
{% load static compress %}
<!DOCTYPE HTML>
<html lang="fr">
......@@ -8,7 +8,9 @@
<title>Notation W</title>
<link rel="stylesheet" href="{% static 'playground/vendors/reset.css' %}">
<link rel="stylesheet" href="{% static 'playground/css/styles.css' %}">
{% compress css %}
<link rel="stylesheet" type="text/css" href="{% static 'playground/css/styles.css' %}">
{% endcompress %}
<script id="base-template" type="text/template">
{% include "playground/underscore/base.mtpl" %}
......@@ -102,6 +104,8 @@
<script src="{% static 'playground/vendors/backbone.paginator.min.js' %}"></script>
<script src="{% static 'playground/vendors/jquery-ui.min.js' %}"></script>
<script src="{% static 'playground/vendors/jquery.mjs.nestedSortable.js' %}"></script>
{% compress js %}
<script src="{% static 'playground/js/models.js' %}"></script>
<script src="{% static 'playground/js/collections.js' %}"></script>
<script src="{% static 'playground/js/views.js' %}"></script>
......@@ -109,6 +113,7 @@
<script src="{% static 'playground/js/routers.js' %}"></script>
<script src="{% static 'playground/js/apps.js' %}"></script>
<script src="{% static 'playground/js/main.js' %}"></script>
{% endcompress %}
</body>
</html>
......@@ -3,3 +3,4 @@ django-registration
djangorestframework
djangorestframework-recursive
psycopg2
django-compressor
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment