1
私はJoomlaのウェブサイトでlessphpを使用しています。私はテンプレートを作成しています。変数を設定し、lessファイルで使用したいと思います。クラスautoCompileLessを使用しますが、私はエラーにlessphpが変数エラーで渡されました。
を得ていることは、変数@fontに渡された解析に失敗しました:
これは私のlessphpコードです:
require_once "lessc.inc.php";
$less = new lessc;
//$css_print .= $less->compile("body {font-family: @bfont;} .vikqt_box {font-family:@font;}");
// create a new cache object, and compile
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;
$less->setVariables(array(
"font" => $fontname,
"bfont" => $bfontname
));
$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(JPATH_SITE.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR.$this->template.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.less', JPATH_SITE.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR.$this->template.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'output.css');
私がチェックした場合が、 output.cssファイル。私の.lessファイルが正しくコンパイルされているのがわかります。なぜこのエラーが出るのか分かりません。 誰かが私に助言を与えることができますか? ありがとうございました!