PHP mutliple .scss Files to one .css File after change -


i compile multiple .scss files 1 .css file.

my code:

<?php class sasscompile {  private $scssfiletype = ".scss"; private $cssfiletype = ".css"; private $cssfilename = "style";  public $scssfolder = "scss/"; public $cssfolder = "css/";  public $scssphp = "scssphp/scss.inc.php"; public $scssphpcompression = "scss_formatter_compressed";  public function compile($scss_folder, $css_folder, $scssphp, $scss_format) {     require $scssphp;      $scss_compiler = new scssc();     $scss_compiler->setimportpaths($scss_folder);     $scss_compiler->setformatter($scss_format);       $filelist = glob($scss_folder . "*" . $this->scssfiletype);     foreach ($filelist $file_path) {         $file_path_elements = pathinfo($file_path);         $file_name = $file_path_elements['filename'];         $file_content = file_get_contents($scss_folder . $file_name . $this->scssfiletype);         $string_css = $scss_compiler->compile($file_content);         file_put_contents($css_folder . $this->cssfilename . $this->cssfiletype, $string_css);     } }  }  $sasscompile = new sasscompile(); $sasscompile->compile($sasscompile->scssfolder, $sasscompile->cssfolder, $sasscompile->scssphp, $sasscompile->scssphpcompression); 

my import.scss looks like

@import "style"; @import "test"; 

i have 2 files in scss folder: "_style.scss" , "_test.scss". these files compilet stle.css in css folder.

everytime page reloaded, css compiled. when have more users, kill webserver.

how can add function compile if file has changes since latest compile done?

thank you


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -