function getOutput($work_unit) { $debug = $this->getConfig()->getDebugMode() == 3; if ($work_unit['file']) { $js = @file_get_contents($work_unit['file']); if (!$js) { return "/* error accessing file */"; } $source_file = $work_unit['file']; } else { $js = $work_unit['content']; $source_file = $this->getSourceFile(); } if ($work_unit['type'] == 'text/coffeescript') { $js = ExternalProcessorRegistry::typeIsSupported('text/coffeescript') ? ExternalProcessorRegistry::getTransformerForType('text/coffeescript')->transform($js, $source_file) : \Coffeescript::build($js); } else { if ($work_unit['type'] == 'text/x-eco') { $eco = ExternalProcessorRegistry::getTransformerForType('text/x-eco'); $js = $eco->transform($js, $source_file, $work_unit['data']); } else { if ($work_unit['type'] == 'text/x-jsx') { $jsx = ExternalProcessorRegistry::getTransformerForType('text/x-jsx'); $js = $jsx->transform($js, $source_file, $work_unit['data']); } } } if ($debug) { return $js; } else { return ExternalProcessorRegistry::typeIsSupported('text/javascript') ? ExternalProcessorRegistry::getCompressorForType('text/javascript')->transform($js, $source_file) : \JSMin::minify($js); } }