PHP code example of flazzarotto / sass-generator

1. Go to this page and download the library: Download flazzarotto/sass-generator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

flazzarotto / sass-generator example snippets


   $bundles = [
     // bunch of other bundles
     new Flazzarotto\SassGeneratorBundle\SassGeneratorBundle(), // <= add this line
   ];
   

   // get the service inside a controller
   $sassGenerator = $this->get('sass_generator');
   
   $sassGenerator->init($sourceMaps, $lineNumbers, $precision, $format, "inputFolder:outputFolder");
   

   // generate css files in output folder from all scss files found in input folder.
   $sassGenerator->compileAll();
   
   // get all scss files found in folder
   $files = $sassGenerator->getSourceFiles();
   
   // compile only one file in css
   $sassGenerator->compile($file[0]); // false on failure, path to css file on success
  
   // compile only one file in sourcemap - css must have been generated before 
   $sassGenerator->generateMap($file[0]); // false on failure, path to sourcemap file on success
   
   // get all warnings encountered during compilation or sourcemap generation
   $sassGenerator->getWarnings(); 
   
   // you can re-initialise the service at any time to compile another scss folder
   $sassGenerator->init(/*params*/);