assets icon indicating copy to clipboard operation
assets copied to clipboard

`AssetLoader::$baseUrl` type allows `null`, but configuration does not

Open arogachev opened this issue 2 years ago • 1 comments

https://github.com/yiisoft/assets/blob/14984b2c8a87236da8c8ef5a4f1273d4ff8a36bc/src/AssetLoader.php#L50

https://github.com/yiisoft/assets/blob/14984b2c8a87236da8c8ef5a4f1273d4ff8a36bc/src/AssetLoader.php#L56

arogachev avatar May 31 '23 05:05 arogachev

There's a mistake in the title, it's about basePath.

final class SliderAsset extends AssetBundle
{
	public ?string $baseUrl = '@frontendAssetsUrl/modules/slider';
	public ?string $basePath = '@frontend/public/assets/modules/slider';

	public array $css = [
		'slider.css',
	];
	public array $js = [
		'slider.js',
	];
}

Files of slider not changes and not has any transformations. In html url will be /assets/modules/slider/slider.js. The logic: Check for basePath here https://github.com/yiisoft/assets/blob/14984b2c8a87236da8c8ef5a4f1273d4ff8a36bc/src/AssetLoader.php#L56 and usege $path here https://github.com/yiisoft/assets/blob/14984b2c8a87236da8c8ef5a4f1273d4ff8a36bc/src/AssetLoader.php#LL93-LL95 only if appendTimestamp = true. It mean i can set basePath = null .

g-rodigy avatar May 31 '23 13:05 g-rodigy