1. Go to this page and download the library: Download ryssbowh/scss-php-compiler 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/ */
ryssbowh / scss-php-compiler example snippets
'beforeCompile': function (array $files)
'afterCompile': function (array $files)
'beforeCompileFile': function (ScssSource $source)
'afterCompileFile': function (ScssSource $source, CompilationResults $results)
'beforeWriteAssets': function (Assets $assets)
'afterWriteAssets': function (Assets $assets)
'beforeAddAsset': function (Asset $asset)
'afterAddAsset': function (Asset $asset)
'beforeExtractAssets': function (CompilationResults $results)
'afterExtractAssets': function (CompilationResults $results)
'extractAsset': function (string $path) : ?string //returning a string will prevent other plugins to access this event
'beforeOptimize': function (CompilationResults $results)
'afterOptimize': function (CompilationResults $results)
'beforeWriteSourcemaps': function (CompilationResults $results, string $name, string $fileName)
'afterWriteSourcemaps': function (CompilationResults $results, string $name, string $fileName)
'importNotFound': function (string $import): ?string //returning a string will prevent other plugins to access this event
'beforeWriteManifest': function (string $file, array $manifest): ?array //Return an array to modify the manifest
'afterWriteManifest': function (array $file, array $manifest)
use Ryssbowh\ScssPhp\plugins\FileLoader;
$plugins = [
new FileLoader([
'test' => '/.+.(?:ico|jpg|jpeg|png|gif)([\?#].*)?$/',
'limit' => 8192, //default
'mimetype' => null //Auto detection
])
];
$compiler = new Compiler([
'publicFolder' => '/path/to/public/folder'
], $plugins);
$plugins = [
new FileLoader([
'test' => '/.+.(?:ico|jpg|jpeg|png|gif)([\?#].*)?$/',
]),
new FileLoader([
'test' => '/.+.svg([\?#].*)?$/',
]),
new FileLoader([
'test' => '/.+.ttf([\?#].*)?$/',
'mimetype' => 'application/octet-stream',
]),
new FileLoader([
'test' => '/.+.woff([\?#].*)?$/',
'mimetype' => 'application/font-woff',
]),
new FileLoader([
'test' => '/.+.woff2([\?#].*)?$/',
'mimetype' => 'application/font-woff',
]),
new FileLoader([
'test' => '/.+.eot([\?#].*)?$/',
]),
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.