PHP 7 Script to Compile SCSS to CSS Code in Command Line Using Scssphp Library

PHP 7 Script to Compile SCSS to CSS Code in Command Line Using scssphp Library

{
    "require": {
        "scssphp/scssphp": "^1.10.3"
    }
}

<span class="nv">$ </span>bin/pscss <span class="nt">-s</span> compressed styles.scss
 

require_once "scssphp/scss.inc.php";
 
use ScssPhp\ScssPhp\Compiler;
 
$compiler = new Compiler();
 
echo $compiler->compileString('
  $color: #abc;
  div { color: lighten($color, 20%); }
')->getCss();

Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment