diff --git a/src/Filter/Uglifyjs.php b/src/Filter/Uglifyjs.php index 4dbcf407..f587512c 100644 --- a/src/Filter/Uglifyjs.php +++ b/src/Filter/Uglifyjs.php @@ -32,6 +32,18 @@ class Uglifyjs extends AssetFilter 'options' => '', ); + /** + * Input filter. + * + * @param string $filename Name of the file + * @param string $content Content of the file. + * @return string + */ + public function input($filename, $content) + { + $this->files[] = $filename; + return $content; + } /** * Run `uglifyjs` against the output and compress it. * @@ -41,8 +53,14 @@ class Uglifyjs extends AssetFilter */ public function output($filename, $input) { - $cmd = $this->_settings['node'] . ' ' . $this->_settings['uglify'] . ' - ' . $this->_settings['options']; + $files = implode(' ', $this->files); + $cmd = + $this->_settings['node'] . ' ' . + $this->_settings['uglify'] . ' ' . + $files . ' ' . + $this->_settings['options']; + $env = array('NODE_PATH' => $this->_settings['node_path']); - return $this->_runCmd($cmd, $input, $env); + return $this->_runCmd($cmd, '', $env); } }