Fix #19270: Replace deprecated scss converter in yii\web\AssetConverter::$commands

This commit is contained in:
Anton
2022-04-08 00:18:36 +03:00
committed by GitHub
parent 1382aea4a8
commit 406ec82f94
2 changed files with 10 additions and 3 deletions

View File

@ -6,6 +6,7 @@ Yii Framework 2 Change Log
- Bug #19243: Handle `finfo_open` for tar.xz as `application/octet-stream` on PHP 8.1 (longthanhtran) - Bug #19243: Handle `finfo_open` for tar.xz as `application/octet-stream` on PHP 8.1 (longthanhtran)
- Bug #19235: Fix return type compatibility of `yii\web\SessionIterator` class methods for PHP 8.1 (virtual-designer) - Bug #19235: Fix return type compatibility of `yii\web\SessionIterator` class methods for PHP 8.1 (virtual-designer)
- Enh #19270: Replace deprecated `scss` converter in `yii\web\AssetConverter::$commands` (WinterSilence)
- Enh #19254: Support specifying custom characters for `yii.validation.trim()` and replace deprecated `jQuery.trim()` (WinterSilence) - Enh #19254: Support specifying custom characters for `yii.validation.trim()` and replace deprecated `jQuery.trim()` (WinterSilence)
- Bug #19291: Reset errors and validators in `yii\base\Model::__clone()` (WinterSilence) - Bug #19291: Reset errors and validators in `yii\base\Model::__clone()` (WinterSilence)
- Enh #19295: Added alias `text/rtf` for mime-type `application/rtf` (lesha724) - Enh #19295: Added alias `text/rtf` for mime-type `application/rtf` (lesha724)

View File

@ -12,7 +12,7 @@ use yii\base\Component;
use yii\base\Exception; use yii\base\Exception;
/** /**
* AssetConverter supports conversion of several popular script formats into JS or CSS scripts. * AssetConverter supports conversion of several popular formats into JS or CSS files.
* *
* It is used by [[AssetManager]] to convert files after they have been published. * It is used by [[AssetManager]] to convert files after they have been published.
* *
@ -25,6 +25,8 @@ class AssetConverter extends Component implements AssetConverterInterface
* @var array the commands that are used to perform the asset conversion. * @var array the commands that are used to perform the asset conversion.
* The keys are the asset file extension names, and the values are the corresponding * The keys are the asset file extension names, and the values are the corresponding
* target script types (either "css" or "js") and the commands used for the conversion. * target script types (either "css" or "js") and the commands used for the conversion.
*
* The command placeholders: `{from}` - source file, `{to}` - converted file.
* *
* You may also use a [path alias](guide:concept-aliases) to specify the location of the command: * You may also use a [path alias](guide:concept-aliases) to specify the location of the command:
* *
@ -33,11 +35,15 @@ class AssetConverter extends Component implements AssetConverterInterface
* 'styl' => ['css', '@app/node_modules/bin/stylus < {from} > {to}'], * 'styl' => ['css', '@app/node_modules/bin/stylus < {from} > {to}'],
* ] * ]
* ``` * ```
*
* Note: `Yii::getAlias()` can replace alias at the begin of the command only.
*
* @see https://sass-lang.com/documentation/cli/ SASS/SCSS
*/ */
public $commands = [ public $commands = [
'less' => ['css', 'lessc {from} {to} --no-color --source-map'], 'less' => ['css', 'lessc {from} {to} --no-color --source-map'],
'scss' => ['css', 'sass {from} {to} --sourcemap'], 'scss' => ['css', 'sass --style=compressed {from} {to}'],
'sass' => ['css', 'sass {from} {to} --sourcemap'], 'sass' => ['css', 'sass --style=compressed {from} {to}'],
'styl' => ['css', 'stylus < {from} > {to}'], 'styl' => ['css', 'stylus < {from} > {to}'],
'coffee' => ['js', 'coffee -p {from} > {to}'], 'coffee' => ['js', 'coffee -p {from} > {to}'],
'ts' => ['js', 'tsc --out {to} {from}'], 'ts' => ['js', 'tsc --out {to} {from}'],