public function toCss($path)
    {
        $filePath = $this->destPath.'/'.$path;
        $subPath = substr($path, 0, strrpos($path, '/'));

        if (is_file($filePath)) {
            $extension = (new \SplFileInfo($filePath))->getExtension();
            switch ($extension) {
                case 'scss':
                    $scssPhp = new Compiler();
                    $scssPhp->setImportPaths($this->destPath.'/'.$subPath);
                    $targetPath = preg_replace('/scss/m', 'css', $path);

                    // compile if target file doesn't exists
                    if (!$this->fileSystem->exists($this->destPath.'/'.$targetPath)) {
                        $scss = file_get_contents($filePath);
                        $css = $scssPhp->compile($scss);
                        $this->fileSystem->dumpFile($this->destPath.'/'.$targetPath, $css);
                    }

                    return $targetPath;
                    break;
                default:
                    throw new Exception(sprintf("File '%s' should be a '.scss'!", $path));
            }
        }

        throw new Exception(sprintf("File '%s' doesn't exist!", $path));
    }
public function toCss($path)
    {
        $filePath = $this->destPath.'/'.$path;
        $subPath = substr($path, 0, strrpos($path, '/'));

        if (is_file($filePath)) {
            $extension = (new \SplFileInfo($filePath))->getExtension();
            switch ($extension) {
                case 'scss':
                    $scssPhp = new Compiler();
                    $scssPhp->setImportPaths($this->destPath.'/'.$subPath);
                    $targetPath = preg_replace('/scss/m', 'css', $path);

                    // compile if target file doesn't exists
                    if (!$this->fileSystem->exists($this->destPath.'/'.$targetPath)) {
                        $scss = file_get_contents($filePath);
                        $css = $scssPhp->compile($scss);
                        $this->fileSystem->dumpFile($this->destPath.'/'.$targetPath, $css);
                    }

                    return $targetPath;
                    break;
                default:
                    throw new Exception(sprintf("File '%s' should be a '.scss'!", $path));
            }
        }

        throw new Exception(sprintf("File '%s' doesn't exist!", $path));
    }
public function toCss ( $ path ) { $ filePath = $ this -> destPath . '/' . $ path ; $ subPath = substr ( $ path , 0 , strrpos ( $ path , '/' ) ) ; if ( is_file ( $ filePath ) ) { $ extension = ( new \ SplFileInfo ( $ filePath ) ) -> getExtension ( ) ; switch ( $ extension ) { case 'scss' : $ scssPhp = new Compiler ( ) ; $ scssPhp -> setImportPaths ( $ this -> destPath . '/' . $ subPath ) ; $ targetPath = preg_replace ( '/scss/m' , 'css' , $ path ) ; // compile if target file doesn't exists if ( ! $ this -> fileSystem -> exists ( $ this -> destPath . '/' . $ targetPath ) ) { $ scss = file_get_contents ( $ filePath ) ; $ css = $ scssPhp -> compile ( $ scss ) ; $ this -> fileSystem -> dumpFile ( $ this -> destPath . '/' . $ targetPath , $ css ) ; } return $ targetPath ; break ; default : throw new Exception ( sprintf ( "File '%s' should be a '.scss'!" , $ path ) ) ; } } throw new Exception ( sprintf ( "File '%s' doesn't exist!" , $ path ) ) ; }
Compile style file to CSS.

@param string $path

@throws Exception

@return string
Compile style file to CSS .