4
* This file is part of the Assetic package, an OpenSky project.
6
* (c) 2010-2013 OpenSky Project Inc
8
* For the full copyright and license information, please view the LICENSE
9
* file that was distributed with this source code.
12
namespace Assetic\Filter;
14
use Assetic\Asset\AssetInterface;
15
use Assetic\Exception\FilterException;
18
* Compiles CoffeeScript into Javascript.
20
* @link http://coffeescript.org/
21
* @author Kris Wallsmith <kris.wallsmith@gmail.com>
23
class CoffeeScriptFilter extends BaseNodeFilter
31
public function __construct($coffeeBin = '/usr/bin/coffee', $nodeBin = null)
33
$this->coffeeBin = $coffeeBin;
34
$this->nodeBin = $nodeBin;
37
public function setBare($bare)
42
public function filterLoad(AssetInterface $asset)
44
$input = tempnam(sys_get_temp_dir(), 'assetic_coffeescript');
45
file_put_contents($input, $asset->getContent());
47
$pb = $this->createProcessBuilder($this->nodeBin
48
? array($this->nodeBin, $this->coffeeBin)
49
: array($this->coffeeBin));
58
$proc = $pb->getProcess();
63
throw FilterException::fromProcess($proc)->setInput($asset->getContent());
66
$asset->setContent($proc->getOutput());
69
public function filterDump(AssetInterface $asset)