From 96eda5cfeb5e5d44a69d989fa18d9f77ad609255 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Fri, 27 May 2016 12:20:14 +0930 Subject: [PATCH] Fix detection of whether or not an asset file is "empty" We can't rely on files/strings for this, since the Locale JsCompiler doesn't use either, but still has content. --- src/Asset/LessCompiler.php | 4 ++++ src/Asset/RevisionCompiler.php | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Asset/LessCompiler.php b/src/Asset/LessCompiler.php index 52546106b..ae619504a 100644 --- a/src/Asset/LessCompiler.php +++ b/src/Asset/LessCompiler.php @@ -38,6 +38,10 @@ class LessCompiler extends RevisionCompiler */ public function compile() { + if (! count($this->files) || ! count($this->strings)) { + return; + } + ini_set('xdebug.max_nesting_level', 200); $parser = new Less_Parser([ diff --git a/src/Asset/RevisionCompiler.php b/src/Asset/RevisionCompiler.php index 50f19b806..6873ccb3c 100644 --- a/src/Asset/RevisionCompiler.php +++ b/src/Asset/RevisionCompiler.php @@ -92,10 +92,10 @@ class RevisionCompiler implements CompilerInterface $file = $this->path.'/'.substr_replace($this->filename, '-'.$current, -strlen($ext) - 1, 0); - if ($this->files || $this->strings) { + if ($content = $this->compile()) { $this->putRevision($current); - file_put_contents($file, $this->compile()); + file_put_contents($file, $content); } else { return; }