<script><?php require '../src/Packer.php'; error_reporting(E_ALL); $js = file_get_contents(__DIR__ . '/' . 'test.js'); $packer = new Tholu\Packer\Packer($js, 'Normal', true, true); $packed_js = $packer->pack(); echo $packed_js; ?> </script>
protected function packJS() { foreach ($this->js as $jsPath) { $jsPath = $this->releasePath . '/' . $jsPath; try { $sJsCode = file_get_contents($jsPath); $oPacker = new \Tholu\Packer\Packer($sJsCode, 'None', true, true, false); $jsPackedCode = $oPacker->pack(); $jsFile = fopen($jsPath, 'w+'); fwrite($jsFile, $jsPackedCode); fclose($jsFile); } catch (\Exception $exception) { throw $exception; } } }