Replace libsass with dart-sass.
authorRadek Czajka <radekczajka@wolnelektury.pl>
Mon, 9 Nov 2026 13:08:41 +0000 (14:08 +0100)
committerRadek Czajka <radekczajka@wolnelektury.pl>
Mon, 9 Nov 2026 13:08:41 +0000 (14:08 +0100)
Dockerfile
requirements/requirements.txt
src/wolnelektury/settings/static.py

index 08ec723..424f37b 100644 (file)
@@ -40,6 +40,11 @@ RUN     apt-get update && apt-get install -y \
        texlive-fonts-extra-links \
        fonts-noto-core fonts-noto-extra
 
        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
 
 
 COPY requirements/requirements.txt requirements.txt
 
index 0ec9083..e60b7b0 100644 (file)
@@ -8,7 +8,6 @@ docutils==0.23
 pymemcache==4.0.0
 
 django-pipeline==3.1.0
 pymemcache==4.0.0
 
 django-pipeline==3.1.0
-libsasscompiler==0.2.1
 jsmin==3.0.1
 
 fnp-django-pagination==2.2.12
 jsmin==3.0.1
 
 fnp-django-pagination==2.2.12
index b83691b..9c2960f 100644 (file)
@@ -134,18 +134,18 @@ PIPELINE = {
             'output_filename': 'js/widget.min.js',
         },
     },
             'output_filename': 'js/widget.min.js',
         },
     },
-    'CSS_COMPRESSOR': None,
     'JS_COMPRESSOR': 'pipeline.compressors.jsmin.JSMinCompressor',
     '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'
 
 }
 
 STATICFILES_STORAGE = 'fnpdjango.pipeline_storage.GzipPipelineManifestStorage'
 
-# PIPELINE_PYSCSS_BINARY = '/usr/bin/env pyscss'
-# PIPELINE_PYSCSS_ARGUMENTS = ''
-
 
 STATICFILES_FINDERS = [
     'django.contrib.staticfiles.finders.FileSystemFinder',
 
 STATICFILES_FINDERS = [
     'django.contrib.staticfiles.finders.FileSystemFinder',