Filters an asset after it has been loaded.
AssetInterface $asset An asset:
Overrides FilterInterface::filterLoad
public function filterLoad(AssetInterface $asset) {
$input = tempnam(sys_get_temp_dir(), 'assetic_roole');
file_put_contents($input, $asset
->getContent());
$pb = $this
->createProcessBuilder($this->nodeBin ? array(
$this->nodeBin,
$this->rooleBin,
) : array(
$this->rooleBin,
));
$pb
->add('-p');
$pb
->add($input);
$proc = $pb
->getProcess();
$code = $proc
->run();
unlink($input);
if (0 !== $code) {
throw FilterException::fromProcess($proc)
->setInput($asset
->getContent());
}
$asset
->setContent($proc
->getOutput());
}