From 755fb70ae2117431c645df049f390460f1cec2e6 Mon Sep 17 00:00:00 2001 From: Kyle Date: Fri, 29 Jul 2016 10:52:18 +0200 Subject: [PATCH] Handle possible comment in the end of scripts --- README.md | 2 +- src/NodejsPhpFallback/Uglify.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b30c5cd..eb86285 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ First you need [composer](https://getcomposer.org/) if you have not already. The use NodejsPhpFallback\Uglify; -// Require the composer autload in your PHP file if it's not already. +// Require the composer autoload in your PHP file if it's not already. // You do not need to if you use a framework with composer like Symfony, Laravel, etc. require 'vendor/autoload.php'; diff --git a/src/NodejsPhpFallback/Uglify.php b/src/NodejsPhpFallback/Uglify.php index 435e96a..6b0b208 100644 --- a/src/NodejsPhpFallback/Uglify.php +++ b/src/NodejsPhpFallback/Uglify.php @@ -37,12 +37,12 @@ public function add($file) public function getSource() { - $source = trim(parent::getSource()); + $source = parent::getSource(); foreach ($this->concat as $file) { if ($this->getMode() === 'js') { - $source = rtrim($source, '; ') . ';'; + $source .= "\n;"; } - $source .= trim(file_get_contents($file)); + $source .= "\n" . file_get_contents($file); } return $source;