Properly handling a style's image path within LESS
authorAlexander Ebert <ebert@woltlab.com>
Wed, 13 Nov 2013 12:12:54 +0000 (13:12 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 13 Nov 2013 12:12:54 +0000 (13:12 +0100)
com.woltlab.wcf/blue-temptation-style.tgz
wcfsetup/install/files/lib/system/style/StyleCompiler.class.php

index 85f5c5aaa49586a4c5e7cf6b7d3840cf14b2d98c..a6fa2662dde8e1040efdc9a61497e77fc04cc88e 100644 (file)
Binary files a/com.woltlab.wcf/blue-temptation-style.tgz and b/com.woltlab.wcf/blue-temptation-style.tgz differ
index 064dc0e36487771253709443d5da3cfe44106541..f93a26905953fa86e52922ee3605f58428c44068 100644 (file)
@@ -73,6 +73,14 @@ class StyleCompiler extends SingletonFactory {
                        unset($variables['individualLess']);
                }
                
+               // add style image path
+               $imagePath = '../images/';
+               if ($style->imagePath) {
+                       $imagePath = FileUtil::getRelativePath(WCF_DIR . 'style/', WCF_DIR . $style->imagePath);
+                       $imagePath = FileUtil::addTrailingSlash(FileUtil::unifyDirSeparator($imagePath));
+               }
+               $variables['style_image_path'] = "'{$imagePath}'";
+               
                // apply overrides
                if (isset($variables['overrideLess'])) {
                        $lines = explode("\n", StringUtil::unifyNewlines($variables['overrideLess']));
@@ -120,6 +128,8 @@ class StyleCompiler extends SingletonFactory {
                // insert blue temptation files
                array_unshift($files, WCF_DIR.'acp/style/blueTemptation/variables.less', WCF_DIR.'acp/style/blueTemptation/override.less');
                
+               $variables['style_image_path'] = "'../images/blueTemptation/'";
+               
                $this->compileStylesheet(
                        WCF_DIR.'acp/style/style',
                        $files,