Merge "Pass the value of STATIC_URL to the scss variable."

This commit is contained in:
Zuul 2025-05-14 18:17:52 +00:00 committed by Gerrit Code Review
commit 4fce531860
2 changed files with 8 additions and 3 deletions

View File

@ -13,11 +13,16 @@
import os.path
from compressor.filters.base import FilterBase
from django.conf import settings
from django.contrib.staticfiles.finders import get_finders
import sass
def static_url():
return settings.STATIC_URL
def importer(path, prev):
if path.startswith('/'):
# An absolute path was used, don't try relative paths.
@ -62,6 +67,7 @@ class ScssFilter(FilterBase):
args = {
'importers': [(0, importer)],
'output_style': 'compressed',
'custom_functions': {static_url},
}
if self.filename:
args['filename'] = self.filename

View File

@ -3,9 +3,8 @@
/* When used with Horizon via Django, this value is set automatically from
settings.py and is added dynamically to the namespace through
horizon/utils/scss_filter.py */
$static_url: "/static/" !default;
settings.py. */
$static_url: static_url() !default;
/* Horizon Custom Variables */