From 39566a898d56addd6b97cc40c45202747b409265 Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Mon, 17 Mar 2014 10:16:22 +0100 Subject: [PATCH] Use relative paths for static-root / css-root - fixes #134 Using paths like /static/wagtailadmin/images/ in our SCSS breaks when a STATIC_URL other than /static/ is in use - for example, when static assets are hosted on an external domain. However, django-compressor consistently puts the compiled CSS at ${STATIC_URL}/CACHE/css/ regardless of operation mode, so we can reliably use ../../ to reach the correct STATIC_URL. --- .../static/wagtailadmin/scss/variables.scss | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wagtail/wagtailadmin/static/wagtailadmin/scss/variables.scss b/wagtail/wagtailadmin/static/wagtailadmin/scss/variables.scss index e1adba10bb..81ca3f9353 100644 --- a/wagtail/wagtailadmin/static/wagtailadmin/scss/variables.scss +++ b/wagtail/wagtailadmin/static/wagtailadmin/scss/variables.scss @@ -1,6 +1,12 @@ /* paths */ -$static-root: "/static/wagtailadmin/images/"; -$css-root: "/static/wagtailadmin/scss/"; + +/* We can't use absolute paths here, because those are dependent on Django's +STATIC_URL setting. However, django-compressor consistently places the compiled +CSS into ${STATIC_URL}/CACHE/css/ regardless of compilation mode, so we can +reliably use relative paths to get back to STATIC_URL. */ + +$static-root: "../../wagtailadmin/images/"; +$css-root: "../../wagtailadmin/scss/"; /* grid settings */ $grid-columns: 12;