102 ?
array($this->nodeBin, $this->uglifyjsBin)
103 :
array($this->uglifyjsBin)
106 if ($this->noCopyright) {
107 $pb->add(
'--no-copyright');
110 if ($this->beautify) {
111 $pb->add(
'--beautify');
115 $pb->add(
'--unsafe');
118 if (
false === $this->mangle) {
119 $pb->add(
'--no-mangle');
122 if ($this->defines) {
123 foreach ($this->defines as $define) {
124 $pb->add(
'-d')->add($define);
132 file_put_contents($input, $asset->
getContent());
133 $pb->add(
'-o')->add(
$output)->add($input);
135 $proc = $pb->getProcess();
136 $code = $proc->run();
145 throw new \RuntimeException(
'Path to node executable could not be resolved.');
152 throw new \RuntimeException(
'Error creating output file.');
155 $uglifiedJs = file_get_contents(
$output);
static createTemporaryFile($prefix)
Creates a temporary file.
setNoCopyright($noCopyright)
Removes the first block of comments as well.
static fromProcess(Process $proc)
setUnsafe($unsafe)
Enable additional optimizations that are known to be unsafe in some situations.
setDefines(array $defines)
filterDump(AssetInterface $asset)
Run the asset through UglifyJs.
createProcessBuilder(array $arguments=array())
getContent()
Returns the loaded content of the current asset.
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
An asset has a mutable URL and content and can be loaded and dumped.
Create styles array
The data for the language used.
__construct($uglifyjsBin='/usr/bin/uglifyjs', $nodeBin=null)
filterLoad(AssetInterface $asset)
setBeautify($beautify)
Output indented code.
setContent($content)
Sets the content of the current asset.
setMangle($mangle)
Safely mangle variable and function names for greater file compress.