changeset 1065:e00ff3dcb5ec

sass: Make sure `load_paths` are relative to the website's root.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 13 Feb 2018 21:51:32 -0800
parents e1e459438f3f
children bd6cc78666b7
files piecrust/processing/sass.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/processing/sass.py	Tue Feb 13 21:29:32 2018 -0800
+++ b/piecrust/processing/sass.py	Tue Feb 13 21:51:32 2018 -0800
@@ -126,6 +126,11 @@
             raise Exception("The `sass/options` configuration setting "
                             "must be an array of arguments.")
 
+        app_root_dir = self.app.root_dir
+        load_paths = list(self._conf['load_paths'])
+        for i, lp in enumerate(load_paths):
+            self._conf['load_paths'][i] = os.path.join(app_root_dir, lp)
+
         cache_dir = None
         if self.app.cache.enabled:
             cache_dir = os.path.join(self.app.cache_dir, 'sass')
@@ -133,8 +138,8 @@
 
     def _getMapPath(self, path):
         map_name = "%s_%s.map" % (
-                os.path.basename(path),
-                hashlib.md5(path.encode('utf8')).hexdigest())
+            os.path.basename(path),
+            hashlib.md5(path.encode('utf8')).hexdigest())
         map_path = os.path.join(self._map_dir, map_name)
         return map_path