From 14ccdb3747519e378f69d2f64f5a041a6dd5391c Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Mon, 9 Nov 2026 14:08:41 +0100 Subject: [PATCH] Replace libsass with dart-sass. --- Dockerfile | 5 +++++ requirements/requirements.txt | 1 - src/wolnelektury/settings/static.py | 14 +++++++------- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 08ec72375..424f37bef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,6 +40,11 @@ RUN apt-get update && apt-get install -y \ texlive-fonts-extra-links \ fonts-noto-core fonts-noto-extra +# Install dart-sass for compiling SCSS. +ARG DART_SASS_VERSION=1.108.1 +RUN arch=$(dpkg --print-architecture | sed 's/amd64/x64/') && \ + curl -fsSL "https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-${arch}.tar.gz" \ + | tar xz -C /opt COPY requirements/requirements.txt requirements.txt diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 0ec90837a..e60b7b0ab 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -8,7 +8,6 @@ docutils==0.23 pymemcache==4.0.0 django-pipeline==3.1.0 -libsasscompiler==0.2.1 jsmin==3.0.1 fnp-django-pagination==2.2.12 diff --git a/src/wolnelektury/settings/static.py b/src/wolnelektury/settings/static.py index b83691b24..9c2960fbd 100644 --- a/src/wolnelektury/settings/static.py +++ b/src/wolnelektury/settings/static.py @@ -134,18 +134,18 @@ PIPELINE = { 'output_filename': 'js/widget.min.js', }, }, - 'CSS_COMPRESSOR': None, 'JS_COMPRESSOR': 'pipeline.compressors.jsmin.JSMinCompressor', - 'COMPILERS': ( - 'libsasscompiler.LibSassCompiler', - ) + 'COMPILERS': ('pipeline.compilers.sass.SASSCompiler',), + 'SASS_BINARY': '/opt/dart-sass/sass', + 'SASS_ARGUMENTS': '--embed-source-map --embed-sources', + # Compress CSSwith a second run of dart-sass. + 'CSS_COMPRESSOR': 'pipeline.compressors.cssmin.CSSMinCompressor', + 'CSSMIN_BINARY': '/opt/dart-sass/sass', + 'CSSMIN_ARGUMENTS': '--stdin --style=compressed --no-source-map', } STATICFILES_STORAGE = 'fnpdjango.pipeline_storage.GzipPipelineManifestStorage' -# PIPELINE_PYSCSS_BINARY = '/usr/bin/env pyscss' -# PIPELINE_PYSCSS_ARGUMENTS = '' - STATICFILES_FINDERS = [ 'django.contrib.staticfiles.finders.FileSystemFinder', -- 2.20.1