From 0a103e7532672f095fdf363962a9335b090c9c38 Mon Sep 17 00:00:00 2001 From: NielsAD Date: Sun, 2 Jun 2013 14:41:58 +0200 Subject: [PATCH] Import once. Fixes issue #396 --- lessc.inc.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lessc.inc.php b/lessc.inc.php index 5c81ad2a..75bcdd4d 100644 --- a/lessc.inc.php +++ b/lessc.inc.php @@ -42,6 +42,7 @@ class lessc { static protected $TRUE = array("keyword", "true"); static protected $FALSE = array("keyword", "false"); + protected $allParsedFiles = array(); protected $libFunctions = array(); protected $registeredVars = array(); protected $preserveComments = false; @@ -108,6 +109,11 @@ protected function tryImport($importPath, $parentBlock, $out) { if ($this->importDisabled) { return array(false, "/* import disabled */"); } + + // import once + if(array_key_exists(realpath($realPath), $this->allParsedFiles())) { + return array(false, ''); + } $this->addParsedFile($realPath); $parser = $this->makeParser($realPath);