33![ PHP] ( https://img.shields.io/badge/PHP-^8.2-blue.svg?style=flat )
44[ ![ Coverage Status] ( https://coveralls.io/repos/github/dragomano/sass-embedded-php/badge.svg?branch=main )] ( https://coveralls.io/github/dragomano/sass-embedded-php?branch=main )
55
6+ [ По-русски] ( README.ru.md )
7+
68> Created for research purposes, not for use on production sites!
79
810PHP wrapper for [ sass-embedded] ( https://www.npmjs.com/package/sass-embedded ) (Dart Sass via Node.js).
@@ -120,12 +122,12 @@ use Bugo\Sass\Compiler;
120122$compiler = new Compiler();
121123
122124try {
123- $changed = $compiler->compileFileAndSave(
125+ $done = $compiler->compileFileAndSave(
124126 __DIR__ . '/assets/style.scss',
125127 __DIR__ . '/assets/style.css'
126128 );
127129
128- if ($changed ) {
130+ if ($done ) {
129131 echo "CSS recompiled and saved.\n";
130132 } else {
131133 echo "No changes detected, skipped compilation.\n";
@@ -149,7 +151,7 @@ $compiler = new Compiler();
149151
150152$css = $compiler->compileFile(__DIR__ . '/assets/app.scss', [
151153 'sourceMap' => true,
152- 'sourceMapIncludeSources ' => true,
154+ 'includeSources ' => true,
153155 'sourceMapPath' => __DIR__ . '/assets/',
154156 'style' => 'compressed',
155157]);
@@ -159,30 +161,23 @@ file_put_contents(__DIR__ . '/assets/app.css', $css);
159161echo "CSS compiled with source map!\n";
160162```
161163
162- ## Parameters
164+ ## Options
163165
164166Paths to bridge.js and Node are specified only through the constructor:
165167
166168``` php
167169$compiler = new Compiler('/path/to/bridge.js', '/path/to/node');
168170```
169171
170- | Parameter | Type | Description | Possible values |
172+ | Option | Type | Description | Possible values |
171173| --------| ------| -------------| -----------------|
172174| syntax | string | Input syntax | 'scss' for SCSS, 'indented' or 'sass' for SASS |
173175| style | string | Output style | 'compressed' or 'expanded' |
174176| sourceMap | bool | Generate source map | true or false |
175- | sourceMapIncludeSources | bool | Include source code in map | true or false |
177+ | includeSources | bool | Include source code in map | true or false |
176178| sourceMapPath | string | URL to existing map or path for saving new | |
177179
178- For some parameters there are alternatives:
179-
180- | Parameter | Type | Description | Possible values |
181- | -----------| ------| -------------| -----------------|
182- | compressed | bool | Same as 'style' => 'compressed' | true or false |
183- | minimize | bool | Same as 'style' => 'compressed' | true or false |
184-
185- Parameters can be set either for the entire compiler at once or for a specific method separately:
180+ Options can be set either for the entire compiler at once or for a specific method separately:
186181
187182``` php
188183$compiler->setOptions([
@@ -191,7 +186,23 @@ $compiler->setOptions([
191186 'sourceMap' => true,
192187]);
193188```
189+
190+ ## Advanced options
191+
192+ These options allow controlling additional aspects of Sass compilation.
193+
194+ | Option | Type | Description | Usage example |
195+ | --------| ------| -------------| ---------------------|
196+ | loadPaths | array<string > | Array of paths for searching Sass imports | ` ['./libs', './node_modules'] ` |
197+ | quietDeps | bool | Suppresses warnings from dependencies | ` true ` |
198+ | silenceDeprecations | bool | Suppresses warnings about deprecated functions | ` true ` |
199+ | verbose | bool | Enables verbose output of messages | ` true ` |
200+
194201``` php
195- $compiler->compileString($string, ['compressed' => true]);
196- $compiler->compileFile($file, ['syntax' => 'sass']);
197- ```
202+ $compiler->setOptions([
203+ 'loadPaths' => ['/path/to/custom/libs'],
204+ 'quietDeps' => true,
205+ 'silenceDeprecations' => true,
206+ 'verbose' => true,
207+ ]);
208+ ```
0 commit comments