1

私は自分の Joomla Web サイトで lessphp を使用しています。テンプレートを作成しています。いくつかの変数を設定し、less ファイルでそれらを使用したいのですが、そのためにクラス autoCompileLess を使用していますが、エラーが発生しています。

変数 @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 ファイルが正しくコンパイルされていることがわかりますが、なぜこのエラーが発生するのかわかりません。誰かが私にアドバイスできますか?皆さん、ありがとうございました!

4

1 に答える 1