for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Staticka\Filters;
/**
* Script Minifier
*
* @package Staticka
* @author Rougin Gutib <[email protected]>
*/
class ScriptMinifier extends InlineMinifier
{
* @var string
protected $tagname = 'script';
* Minifies the specified code.
* @param string $code
* @return string
protected function minify($code)
$code = (string) parent::minify($code);
$code = preg_replace('/( )?=( )?/', '=', $code);
$code = preg_replace('/( )?\(( )?/', '(', $code);
return preg_replace('/( )?var ( )?/', '', $code);
}