diff --git a/aleksis/core/settings.py b/aleksis/core/settings.py index 6cb8447f192b5f57dc1b50f1d4cc2f19b1ef2d76..318c669ae02c4afd3f410989a6b9a154c00cd969 100644 --- a/aleksis/core/settings.py +++ b/aleksis/core/settings.py @@ -817,3 +817,7 @@ if _settings.get("storage.s3.enabled", False): AWS_S3_GZIP = _settings.get("storage.s3.gzip", True) AWS_S3_SIGNATURE_VERSION = _settings.get("storage.s3.signature_version", None) AWS_S3_FILE_OVERWRITE = _settings.get("storage.s3.file_overwrite", False) +else: + DEFAULT_FILE_STORAGE = "django.core.files.storage.FileSystemStorage" + +SASS_PROCESSOR_STORAGE = DEFAULT_FILE_STORAGE diff --git a/aleksis/core/util/sass_helpers.py b/aleksis/core/util/sass_helpers.py index cff75a936f81801eeeae1839bdc8d59eaef739cd..2579ed83a6f7d7f143456e227f1c662987ba3f55 100644 --- a/aleksis/core/util/sass_helpers.py +++ b/aleksis/core/util/sass_helpers.py @@ -1,12 +1,8 @@ """Helpers for SASS/SCSS compilation.""" -import os -from glob import glob - -from django.conf import settings - from colour import web2hex from sass import SassColor +from sass_processor.storage import SassFileStorage from .core_helpers import get_site_preferences @@ -26,9 +22,8 @@ def get_preference(section: str, name: str) -> str: def clean_scss(*args, **kwargs) -> None: """Unlink compiled CSS (i.e. cache invalidation).""" - for source_map in glob(os.path.join(settings.STATIC_ROOT, "*.css.map")): - try: - os.unlink(source_map) - except OSError: - # Ignore because old is better than nothing - pass # noqa + sass_storage = SassFileStorage() + __, files = sass_storage.listdir("") + + for source_map in filter(lambda x: x.endswith(".css.map"), files): + sass_storage.delete(source_map) diff --git a/pyproject.toml b/pyproject.toml index 98ae664307db1880be89e54924ada8880227da5b..4e33a56e3be07176473c35e660290e433c0064e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ django-menu-generator-ng = "^1.2.3" django-tables2 = "^2.1" Pillow = "^8.0" django-phonenumber-field = {version = "<5.1", extras = ["phonenumbers"]} -django-sass-processor = "^0.8" +django-sass-processor = "^1.0" libsass = "^0.20.0" colour = "^0.1.5" dynaconf = {version = "^3.1", extras = ["yaml", "toml", "ini"]}