Less PHP (http://leafo.net/lessphp/docs/) has a great method
function autoCompileLess($inputFile, $outputFile) {
// load the cache
$cacheFile = $inputFile.".cache";
if (file_exists($cacheFile)) {
$cache = unserialize(file_get_contents($cacheFile));
} else {
$cache = $inputFile;
}
$less = new lessc;
$newCache = $less->cachedCompile($cache);
if (!is_array($cache) || $newCache["updated"] > $cache["updated"]) {
file_put_contents($cacheFile, serialize($newCache));
file_put_contents($outputFile, $newCache['compiled']);
}
}
autoCompileLess('myfile.less', 'myfile.css');
Is there any option to do same thing with http://leafo.net/scssphp/, for SASS? I can't find alternative to cachedCompile()
with scssphp.