라이믹스에서 지원되는 SCSS 기능중에 지원안되는 기능들이 좀 있습니다.

이런 기능들을 어떻게든 쓰시고 싶은 분을 위한 팁입니다.

단, 현재 PHP 7.2 이상을 쓰고 있으셔야 합니다.

 

https://github.com/scssphp/scssphp/archive/refs/heads/master.zip

 

일단 gitub에서 scssphp 최신 버젼을 다운로드 받습니다.

그 다음에 /vendor/scssphp에 가서 현재 깔려있는 scssphp 폴더 이름을 scssphp-old로 바꾼 뒤에

위에서 다운로드 받은 파일을 압축해제해서 scssphp라는 이름의 폴더에 넣어주세요.

 

그 다음에 /common/framework/formatter.php 파일을 열어서 233라인으로 갑니다.

기존의 코드를 다음과 같이 교체합니다.

 

foreach ( $variables as $key => $val )
  $variables[$key] = \ScssPhp\ScssPhp\ValueConverter::parseValue($val);

// Compile!
try
{
  $scss_compiler = new \ScssPhp\ScssPhp\Compiler;
  $scss_compiler->setOutputStyle($minify ? \ScssPhp\ScssPhp\OutputStyle::COMPRESSED : \ScssPhp\ScssPhp\OutputStyle::EXPANDED);
  $scss_compiler->setImportPaths(array(dirname(is_array($source_filename) ? array_first($source_filename) : $source_filename)));
  if ($variables)
  {
    $scss_compiler->addVariables($variables);
  }

  $content = $scss_compiler->compileString($content) ;
  $content = $content->getCss() . '\n';
  $content = strpos($content, '@charset') === false ? ('@charset "UTF-8";' . "\n" . $content) : $content;
  $result = true;
}

 

catch 직전까지입니다.

이렇게 바꾸시면 현재 지원안되는 SCSS 기능들중 상당수가 해금될 것입니다.

제 사이트에 시험 적용했는데 현재까진 아무 문제 없는걸로 보이는군요.

  • profile
    git 사용하여 업데이트 하시는 분은 해당 팁을 강제적으로 적용하여 설정시 추후 git 으로 업데이트 하는 방법이 먹히지 않거나 업데이트시 복잡해질수 있으니 사용시 주의하시기 바랍니다ㅎㅎ