Skip to content

Commit

Permalink
Fix #19270: Replace deprecated scss converter in `yii\web\AssetConv…
Browse files Browse the repository at this point in the history
…erter::$commands`
  • Loading branch information
WinterSilence committed Apr 7, 2022
1 parent 1382aea commit 406ec82
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions framework/CHANGELOG.md
Expand Up @@ -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 #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)
- Bug #19291: Reset errors and validators in `yii\base\Model::__clone()` (WinterSilence)
- Enh #19295: Added alias `text/rtf` for mime-type `application/rtf` (lesha724)
Expand Down
12 changes: 9 additions & 3 deletions framework/web/AssetConverter.php
Expand Up @@ -12,7 +12,7 @@
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.
*
Expand All @@ -25,6 +25,8 @@ class AssetConverter extends Component implements AssetConverterInterface
* @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
* 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:
*
Expand All @@ -33,11 +35,15 @@ class AssetConverter extends Component implements AssetConverterInterface
* '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 = [
'less' => ['css', 'lessc {from} {to} --no-color --source-map'],
'scss' => ['css', 'sass {from} {to} --sourcemap'],
'sass' => ['css', 'sass {from} {to} --sourcemap'],
'scss' => ['css', 'sass --style=compressed {from} {to}'],
'sass' => ['css', 'sass --style=compressed {from} {to}'],
'styl' => ['css', 'stylus < {from} > {to}'],
'coffee' => ['js', 'coffee -p {from} > {to}'],
'ts' => ['js', 'tsc --out {to} {from}'],
Expand Down

0 comments on commit 406ec82

Please sign in to comment.