Skip to content

Commit

Permalink
✨ added custom static file storage class
Browse files Browse the repository at this point in the history
  • Loading branch information
bart-maykin committed Nov 17, 2023
1 parent 28bdec7 commit cfcbf10
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/openklant/conf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down
16 changes: 16 additions & 0 deletions src/openklant/conf/staticstorage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from django.contrib.staticfiles.storage import ManifestStaticFilesStorage


class NoSourceMapsStorage(ManifestStaticFilesStorage):
patterns = (
(
"*.css",
(
"(?P<matched>url\\(['\"]{0,1}\\s*(?P<url>.*?)[\"']{0,1}\\))",
(
"(?P<matched>@import\\s*[\"']\\s*(?P<url>.*?)[\"'])",
'@import url("%(url)s")',
),
),
),
)

0 comments on commit cfcbf10

Please sign in to comment.