src/StaticDeploy/Compiler/Compiler.php
public function parse($resource, $output)
    {
        printf('file %s' . PHP_EOL, $resource);

        $pathinfo = pathinfo($resource);
        $extension = $pathinfo['extension'];

        $this->environment->setSourceFile($resource);

        $parser = $this->configuration->getParserForFileExtension($extension);

        if (!$parser instanceof ParserInterface) {
            throw new \Exception('No parser found. Have you initialized any plugins?');
        }

        if ($parser instanceof HasEnvironmentInterface) {
            $parser->setEnvironment($this->environment);
        }

        $content = $parser->parse($resource);
        $output  = $parser->getOutputFilename($output);
        file_put_contents($output, $content);
    }
public function parse($resource, $output)
    {
        printf('file %s' . PHP_EOL, $resource);

        $pathinfo = pathinfo($resource);
        $extension = $pathinfo['extension'];

        $this->environment->setSourceFile($resource);

        $parser = $this->configuration->getParserForFileExtension($extension);

        if (!$parser instanceof ParserInterface) {
            throw new \Exception('No parser found. Have you initialized any plugins?');
        }

        if ($parser instanceof HasEnvironmentInterface) {
            $parser->setEnvironment($this->environment);
        }

        $content = $parser->parse($resource);
        $output  = $parser->getOutputFilename($output);
        file_put_contents($output, $content);
    }
public function parse ( $ resource , $ output ) { printf ( 'file %s' . PHP_EOL , $ resource ) ; $ pathinfo = pathinfo ( $ resource ) ; $ extension = $ pathinfo [ 'extension' ] ; $ this -> environment -> setSourceFile ( $ resource ) ; $ parser = $ this -> configuration -> getParserForFileExtension ( $ extension ) ; if ( ! $ parser instanceof ParserInterface ) { throw new \ Exception ( 'No parser found. Have you initialized any plugins?' ) ; } if ( $ parser instanceof HasEnvironmentInterface ) { $ parser -> setEnvironment ( $ this -> environment ) ; } $ content = $ parser -> parse ( $ resource ) ; $ output = $ parser -> getOutputFilename ( $ output ) ; file_put_contents ( $ output , $ content ) ; }
Will parse a given file, and will write it to output directory

@param string $resource filename of source file
@param string $output directory of destination
@throws \Exception
Will parse a given file and will write it to output directory