Created
May 15, 2018 10:26
-
-
Save yasaryousuf/fa2350d7ea6c1e018ca4d475707710fd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function compiler($in, $out) | |
{ | |
try { | |
$scss = new Compiler(); | |
$scss->setImportPaths(OP_PATH.'assets/scss/'); | |
echo $css = $scss->compile(file_get_contents($in), $in); | |
file_put_contents($out, $css); | |
} | |
catch (Exception $e) { | |
$errors = array ( | |
'file' => basename($in), | |
'message' => $e->getMessage(), | |
); | |
array_push($instance->compile_errors, $errors); | |
echo '<pre>'; print_r($errors); echo '</pre>'; | |
} | |
} | |
public function wp_scss() | |
{ | |
foreach(new DirectoryIterator($this->scss_dir) as $file) | |
{ | |
if (substr($file, 0, 1) != "_" && pathinfo($file->getFilename(), PATHINFO_EXTENSION) == 'scss') | |
{ | |
$input = $this->scss_dir.$file->getFilename(); | |
$outputName = preg_replace("/\.[^$]*/",".css", $file->getFilename()); | |
$output = $this->css_dir.$outputName; | |
$this->compiler($input, $output); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment