Compile scss files with django compressor

This commit is contained in:
Jens Kadenbach 2019-09-12 12:56:37 +02:00
parent d372cd9bf2
commit 2d5365d2a8
7 changed files with 9 additions and 17 deletions

View file

@ -16,7 +16,7 @@ RUN apk update \
&& apk add postgresql-client \ && apk add postgresql-client \
# https://weasyprint.readthedocs.io/en/latest/install.html # https://weasyprint.readthedocs.io/en/latest/install.html
&& apk add gcc musl-dev jpeg-dev zlib-dev libffi-dev cairo-dev pango-dev gdk-pixbuf-dev \ && apk add gcc musl-dev jpeg-dev zlib-dev libffi-dev cairo-dev pango-dev gdk-pixbuf-dev \
&& apk add ttf-ubuntu-font-family && apk add libsass sassc
# Requirements are installed here to ensure they will be cached. # Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements COPY ./requirements /requirements

View file

@ -13,7 +13,7 @@ RUN apk update \
&& apk add libffi-dev py-cffi \ && apk add libffi-dev py-cffi \
# https://weasyprint.readthedocs.io/en/latest/install.html # https://weasyprint.readthedocs.io/en/latest/install.html
&& apk add gcc musl-dev jpeg-dev zlib-dev libffi-dev cairo-dev pango-dev gdk-pixbuf-dev \ && apk add gcc musl-dev jpeg-dev zlib-dev libffi-dev cairo-dev pango-dev gdk-pixbuf-dev \
&& apk add ttf-ubuntu-font-family && apk add libsass sassc
RUN addgroup -S django \ RUN addgroup -S django \
&& adduser -S -G django django && adduser -S -G django django

View file

@ -265,5 +265,8 @@ SOCIALACCOUNT_ADAPTER = "schickmacher.users.adapters.SocialAccountAdapter"
# https://django-compressor.readthedocs.io/en/latest/quickstart/#installation # https://django-compressor.readthedocs.io/en/latest/quickstart/#installation
INSTALLED_APPS += ["compressor"] INSTALLED_APPS += ["compressor"]
STATICFILES_FINDERS += ["compressor.finders.CompressorFinder"] STATICFILES_FINDERS += ["compressor.finders.CompressorFinder"]
COMPRESS_PRECOMPILERS = (
('text/x-scss', 'sassc {infile} {outfile}'),
)
# Your stuff... # Your stuff...
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------

View file

@ -1,13 +0,0 @@
/* These styles are generated from project.scss. */
.alert-debug {
color: black;
background-color: white;
border-color: #d6e9c6;
}
.alert-error {
color: #b94a48;
background-color: #f2dede;
border-color: #eed3d7;
}

View file

@ -25,7 +25,7 @@
{% compress css %} {% compress css %}
<!-- This file stores project-specific CSS --> <!-- This file stores project-specific CSS -->
<link href="{% static 'css/project.css' %}" rel="stylesheet"> <link type="text/x-scss" href="{% static 'sass/project.scss' %}" rel="stylesheet">
{% endcompress %} {% endcompress %}
{% endblock %} {% endblock %}

View file

@ -3,7 +3,9 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>{{ title }}</title> <title>{{ title }}</title>
<link href="{% static 'css/render.css' %}" rel="stylesheet"> {% compress css %}
<link type="text/x-scss" href="{% static 'sass/render.scss' %}" rel="stylesheet">
{% endcompress %}
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap" rel="stylesheet">
</head> </head>