From 2fc593e88a74c254aeec35254e7e7a0ee705166d Mon Sep 17 00:00:00 2001
From: Thomas Steur <thomas.steur@googlemail.com>
Date: Mon, 24 Feb 2014 00:00:35 +0100
Subject: [PATCH] refs #2174 add an import directory only if the asset contains
 an @import. Fixes a file named admin.less file in any plugin overwrites the
 admin.less file in Morpheus plugin

---
 .../AssetManager/UIAssetMerger/StylesheetUIAssetMerger.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/core/AssetManager/UIAssetMerger/StylesheetUIAssetMerger.php b/core/AssetManager/UIAssetMerger/StylesheetUIAssetMerger.php
index 633443ef6f..b135cc0e82 100644
--- a/core/AssetManager/UIAssetMerger/StylesheetUIAssetMerger.php
+++ b/core/AssetManager/UIAssetMerger/StylesheetUIAssetMerger.php
@@ -31,7 +31,12 @@ class StylesheetUIAssetMerger extends UIAssetMerger
     protected function getMergedAssets()
     {
         foreach($this->getAssetCatalog()->getAssets() as $uiAsset) {
-            $this->lessCompiler->addImportDir(dirname($uiAsset->getAbsoluteLocation()));
+
+            $content = $uiAsset->getContent();
+            if (false !== strpos($content, '@import')) {
+                $this->lessCompiler->addImportDir(dirname($uiAsset->getAbsoluteLocation()));
+            }
+
         }
 
         return $this->lessCompiler->compile($this->getConcatenatedAssets());
-- 
GitLab