Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
arogachev opened this issue May 31, 2023 · 1 comment
Open
Labels

Comments

@arogachev
Copy link

private ?string $baseUrl = null

if (!$bundle->cdn && empty($this->basePath) && empty($bundle->basePath)) {

@arogachev arogachev added the type:bug Bug label May 31, 2023
@g-rodigy
Copy link

g-rodigy commented May 31, 2023

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

if (!$bundle->cdn && empty($this->basePath) && empty($bundle->basePath)) {
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 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants