public function filterLoad(AssetInterface $asset)
    {
        $inputFile = tempnam(sys_get_temp_dir(), 'csso');

        file_put_contents($inputFile, $asset->getContent());

        // Before we create our process builder we'll create the arguments to be given to the builder.
        // If we have a node bin supplied then we'll shift that to the beginning of the array.
        $builderArguments = array($this->cssoBin);

        if ( ! is_null($this->nodeBin))
        {
            array_unshift($builderArguments, $this->nodeBin);
        }

        $builder = $this->createProcessBuilder($builderArguments);

        $builder->add($inputFile);

        // Get the process from the builder and run the process.
        $process = $builder->getProcess();

        $code = $process->run();

        unlink($inputFile);

        if ($code !== 0)
        {
            throw FilterException::fromProcess($process)->setInput($asset->getContent());
        }

        $asset->setContent($process->getOutput());
    }
public function filterLoad(AssetInterface $asset)
    {
        $inputFile = tempnam(sys_get_temp_dir(), 'csso');

        file_put_contents($inputFile, $asset->getContent());

        // Before we create our process builder we'll create the arguments to be given to the builder.
        // If we have a node bin supplied then we'll shift that to the beginning of the array.
        $builderArguments = array($this->cssoBin);

        if ( ! is_null($this->nodeBin))
        {
            array_unshift($builderArguments, $this->nodeBin);
        }

        $builder = $this->createProcessBuilder($builderArguments);

        $builder->add($inputFile);

        // Get the process from the builder and run the process.
        $process = $builder->getProcess();

        $code = $process->run();

        unlink($inputFile);

        if ($code !== 0)
        {
            throw FilterException::fromProcess($process)->setInput($asset->getContent());
        }

        $asset->setContent($process->getOutput());
    }
public function filterLoad ( AssetInterface $ asset ) { $ inputFile = tempnam ( sys_get_temp_dir ( ) , 'csso' ) ; file_put_contents ( $ inputFile , $ asset -> getContent ( ) ) ; // Before we create our process builder we'll create the arguments to be given to the builder. // If we have a node bin supplied then we'll shift that to the beginning of the array. $ builderArguments = array ( $ this -> cssoBin ) ; if ( ! is_null ( $ this -> nodeBin ) ) { array_unshift ( $ builderArguments , $ this -> nodeBin ) ; } $ builder = $ this -> createProcessBuilder ( $ builderArguments ) ; $ builder -> add ( $ inputFile ) ; // Get the process from the builder and run the process. $ process = $ builder -> getProcess ( ) ; $ code = $ process -> run ( ) ; unlink ( $ inputFile ) ; if ( $ code !== 0 ) { throw FilterException :: fromProcess ( $ process ) -> setInput ( $ asset -> getContent ( ) ) ; } $ asset -> setContent ( $ process -> getOutput ( ) ) ; }
Apply filter on file load.

@param  \Assetic\Asset\AssetInterface  $asset
@return void
Apply filter on file load .