mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 07:13:59 +01:00
Slice 4 chars from end (for less and scss)
The char position used by $fileNameExtPos is actually from the beginning, not end, so is useless here However, we know that 'less' and 'scss' are 4 chars, so we can just slice off those 4 chars always
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
// Compiling Sass and LESS files (.scss and .less to .css version, with same name, in same dir)
|
||||
|
||||
$fileName = basename($file);
|
||||
$fileNameExtPos = strrpos($fileName,".");
|
||||
$filePieces = explode(".",$file);
|
||||
$fileExt = $filePieces[count($filePieces)-1];
|
||||
|
||||
@@ -25,7 +24,7 @@ if (strtolower($fileExt) == "scss" && file_exists(dirname(__FILE__)."/../plugins
|
||||
|
||||
try {
|
||||
$scssContent = $scss->compile('@import "'.$fileName.'"');
|
||||
$fh = fopen(substr($file, 0, -$fileNameExtPos)."css", 'w');
|
||||
$fh = fopen(substr($file, 0, -4)."css", 'w');
|
||||
fwrite($fh, $scssContent);
|
||||
fclose($fh);
|
||||
} catch (Exception $e) {
|
||||
@@ -44,7 +43,7 @@ if (strtolower($fileExt) == "less" && file_exists(dirname(__FILE__)."/../plugins
|
||||
$less->setPreserveComments(false); // true or false
|
||||
|
||||
try {
|
||||
$less->checkedCompile($file, substr($file, 0, -$fileNameExtPos)."css"); // Note: Only recompiles if changed
|
||||
$less->checkedCompile($file, substr($file, 0, -4)."css"); // Note: Only recompiles if changed
|
||||
} catch (Exception $e) {
|
||||
echo ";top.ICEcoder.message('Couldn\'t compile your LESS, error info below:\\n\\n".$e->getMessage()."');";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user