Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions lessc.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1823,13 +1823,30 @@ protected function addParsedFile($file) {
public static function ccompile($in, $out) {
if (!is_file($out) || filemtime($in) > filemtime($out)) {
$less = new lessc($in);
self::createPath($out);
file_put_contents($out, $less->parse());
return true;
}

return false;
}

// ensures that a path exists (creates it if not)
// ignores a file at the end if there is one - only creates directories
private static function createPath($path) {
$parts = explode('/',$path);
$dirs = array_slice($parts, 0, count($parts)-1);

$curdir = '';
foreach($dirs as $dir) {
$curdir .= $dir.'/';

if(!file_exists($curdir)) {
mkdir($curdir);
}
}
}

/**
* Execute lessphp on a .less file or a lessphp cache structure
*
Expand Down