From edf313a7a2ced9ec7c822658486b84c022d13489 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 21 Oct 2015 17:21:14 -0600 Subject: [PATCH] Fix for empty pipeline asset file --- system/src/Grav/Common/Assets.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/system/src/Grav/Common/Assets.php b/system/src/Grav/Common/Assets.php index 3d2f4b4f5..ab5314d61 100644 --- a/system/src/Grav/Common/Assets.php +++ b/system/src/Grav/Common/Assets.php @@ -539,12 +539,14 @@ class Assets $attributes = $this->attributes(array_merge(['type' => 'text/javascript'], $attributes)); - $output = ''; $inline_js = ''; if ($this->js_pipeline) { - $output .= '' . "\n"; + $pipeline_result = $this->pipeline(JS_ASSET, $group); + if ($pipeline_result) { + $output .= '' . "\n"; + } foreach ($this->js_no_pipeline as $file) { if ($group && $file['group'] == $group) { $output .= '' . "\n"; @@ -649,9 +651,12 @@ class Assets } // Write file - file_put_contents($absolute_path, $buffer); - - return $relative_path . $key; + if (strlen(trim($buffer)) > 0) { + file_put_contents($absolute_path, $buffer); + return $relative_path . $key; + } else { + return false; + } } /**