From afb4fde683cf2fe859ffa69d0e85dfad8d4910da Mon Sep 17 00:00:00 2001 From: Dominik George <dominik.george@teckids.org> Date: Wed, 21 Aug 2019 17:18:47 +0200 Subject: [PATCH] Clean up SCSS on startup. --- biscuit/core/__init__.py | 1 + biscuit/core/apps.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 biscuit/core/apps.py diff --git a/biscuit/core/__init__.py b/biscuit/core/__init__.py index e69de29bb..cae737057 100644 --- a/biscuit/core/__init__.py +++ b/biscuit/core/__init__.py @@ -0,0 +1 @@ +default_app_config = 'biscuit.core.apps.CoreConfig' diff --git a/biscuit/core/apps.py b/biscuit/core/apps.py new file mode 100644 index 000000000..b2afdd550 --- /dev/null +++ b/biscuit/core/apps.py @@ -0,0 +1,22 @@ +from glob import glob +import os + +from django.apps import AppConfig +from django.conf import settings +from django.utils.translation import gettext_lazy as _ + + +class CoreConfig(AppConfig): + name = 'biscuit.core' + verbose_name = _('BiscuIT - The Free School Information System') + + def clean_scss(self): + 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 + + def ready(self): + self.clean_scss() -- GitLab