diff --git a/src/openklant/conf/base.py b/src/openklant/conf/base.py index 1434d9572..bc61cfb05 100644 --- a/src/openklant/conf/base.py +++ b/src/openklant/conf/base.py @@ -205,6 +205,8 @@ "django.contrib.staticfiles.finders.AppDirectoriesFinder", ] +STATICFILES_STORAGE = "openklant.conf.staticstorage.NoSourceMapsStorage" + MEDIA_ROOT = os.path.join(BASE_DIR, "media") MEDIA_URL = "/media/" diff --git a/src/openklant/conf/staticstorage.py b/src/openklant/conf/staticstorage.py new file mode 100644 index 000000000..581887262 --- /dev/null +++ b/src/openklant/conf/staticstorage.py @@ -0,0 +1,16 @@ +from django.contrib.staticfiles.storage import ManifestStaticFilesStorage + + +class NoSourceMapsStorage(ManifestStaticFilesStorage): + patterns = ( + ( + "*.css", + ( + "(?Purl\\(['\"]{0,1}\\s*(?P.*?)[\"']{0,1}\\))", + ( + "(?P@import\\s*[\"']\\s*(?P.*?)[\"'])", + '@import url("%(url)s")', + ), + ), + ), + )