Skip to content

Commit 3d40451

Browse files
committed
Update README files
1 parent 5c40a9e commit 3d40451

File tree

2 files changed

+53
-31
lines changed

2 files changed

+53
-31
lines changed

README.md

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
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
810
PHP 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

122124
try {
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);
159161
echo "CSS compiled with source map!\n";
160162
```
161163

162-
## Parameters
164+
## Options
163165

164166
Paths 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+
```

README.ru.md

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
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+
[English](README.md)
7+
68
> Создано в исследовательских целях, не для использования на рабочих сайтах!
79
810
PHP-обёртка для [sass-embedded](https://www.npmjs.com/package/sass-embedded) (Dart Sass через Node.js).
@@ -120,12 +122,12 @@ use Bugo\Sass\Compiler;
120122
$compiler = new Compiler();
121123

122124
try {
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 перекомпилирован и сохранен.\n";
130132
} else {
131133
echo "Изменений не обнаружено, компиляция пропущена.\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
]);
@@ -172,16 +174,9 @@ $compiler = new Compiler('/path/to/bridge.js', '/path/to/node');
172174
| syntax | string | Синтаксис входного файла | 'scss' для SCSS, 'indented' или 'sass' для SASS |
173175
| style | string | Стиль вывода | 'compressed' или 'expanded' |
174176
| sourceMap | bool | Генерировать карту источников | true или false |
175-
| sourceMapIncludeSources | bool | Включать исходный код в карту | true или false |
177+
| includeSources | bool | Включать исходный код в карту | true или false |
176178
| sourceMapPath | string | URL-адрес уже созданной карты или путь для сохранения новой | |
177179

178-
Для некоторых параметров есть альтернативы:
179-
180-
| Параметр | Тип | Описание | Возможные значения |
181-
|---|---|---|---|
182-
| compressed | bool | То же, что и 'style' => 'compressed' | true или false |
183-
| minimize | bool | То же, что и 'style' => 'compressed' | true или false |
184-
185180
Параметры можно включать как для всего компилятора сразу, так и для конкретного метода отдельно:
186181

187182
```php
@@ -191,7 +186,23 @@ $compiler->setOptions([
191186
'sourceMap' => true,
192187
]);
193188
```
189+
190+
## Расширенные опции
191+
192+
Эти опции позволяют контролировать дополнительные аспекты компиляции Sass.
193+
194+
| Опция | Тип | Описание | Пример использования |
195+
|--------|------|-------------|---------------------|
196+
| loadPaths | array<string> | Массив путей для поиска импортов Sass | `['./libs', './node_modules']` |
197+
| quietDeps | bool | Подавляет предупреждения от зависимостей | `true` |
198+
| silenceDeprecations | bool | Подавляет предупреждения об устаревших функциях | `true` |
199+
| verbose | bool | Включает подробный вывод сообщений | `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

Comments
 (0)