Created
February 16, 2012 21:23
-
-
Save enumag/1847959 to your computer and use it in GitHub Desktop.
ISS helper
This file contains 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
/** | |
* @param string | |
* @param string | |
* @return bool | |
*/ | |
function issCheck($dir, $out) { | |
if (!file_exists($out)) { | |
return TRUE; | |
} | |
$time = filemtime($out); | |
$it = new DirectoryIterator($dir); | |
foreach ($it as $file) { | |
if ($file->isFile() && $file->getMTime() > $time) { | |
return TRUE; | |
} | |
} | |
} | |
/** | |
* @param string | |
* @return string | |
*/ | |
function issCompile($in) { | |
$out = '/cache/css/' . pathinfo($in, PATHINFO_FILENAME) . '.css'; | |
if (issCheck(dirname($in), __DIR__ . $out)) { | |
$ivory = new \Ivory\StyleSheets\Compiler(); | |
$ivory->outputDirectory = __DIR__ . '/cache/css/'; | |
$ivory->setDefaultUnit('px'); | |
$ivory->compileFile($in); | |
} | |
return $out; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment