PHP 클래스 yii\web\AssetConverter

It is used by AssetManager to convert files after they have been published.
부터: 2.0
저자: Qiang Xue ([email protected])
상속: extends yii\base\Component, implements yii\web\AssetConverterInterface
파일 보기 프로젝트 열기: yiisoft/yii2 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$commands 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. You may also use a path alias to specify the location of the command: php [ 'styl' => ['css', '@app/node_modules/bin/stylus < {from} > {to}'], ]
$forceConvert whether the source asset file should be converted even if its result already exists. You may want to set this to be true during the development stage to make sure the converted assets are always up-to-date. Do not set this to true on production servers as it will significantly degrade the performance.

공개 메소드들

메소드 설명
convert ( string $asset, string $basePath ) : string Converts a given asset file into a CSS or JS file.

보호된 메소드들

메소드 설명
runCommand ( string $command, string $basePath, string $asset, string $result ) : boolean Runs a command to convert asset files.

메소드 상세

convert() 공개 메소드

Converts a given asset file into a CSS or JS file.
public convert ( string $asset, string $basePath ) : string
$asset string the asset file path, relative to $basePath
$basePath string the directory the $asset is relative to.
리턴 string the converted asset file path, relative to $basePath.

runCommand() 보호된 메소드

Runs a command to convert asset files.
protected runCommand ( string $command, string $basePath, string $asset, string $result ) : boolean
$command string the command to run. If prefixed with an `@` it will be treated as a path alias.
$basePath string asset base path and command working directory
$asset string the name of the asset file
$result string the name of the file to be generated by the converter command
리턴 boolean true on success, false on failure. Failures will be logged.

프로퍼티 상세

$commands 공개적으로 프로퍼티

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. You may also use a path alias to specify the location of the command: php [ 'styl' => ['css', '@app/node_modules/bin/stylus < {from} > {to}'], ]
public $commands

$forceConvert 공개적으로 프로퍼티

whether the source asset file should be converted even if its result already exists. You may want to set this to be true during the development stage to make sure the converted assets are always up-to-date. Do not set this to true on production servers as it will significantly degrade the performance.
public $forceConvert