Argument 2 passed to Orchestra\Asset\Asset::style() must be of the type string
Hi, if you use @css or @js with a url without http(s), it results in the above error. EG:
@css('//cdn/file') or @js('//cdn/file')
A fix I propose for this is to modify Theme.php, and in the function url(), add the following to the beginning of the function:
public function url($url)
{
// return external URLs unmodified
if (preg_match('#^//#',$url))
return $url;
$url = ltrim($url, '/');
...
Fixed!
BTW: I needed to apply the same fix to the url() function in src/Themes.php
IE:
// Return url of current theme
public function url($filename)
{
if (preg_match('/^((http(s?):)?\/\/)/i', $filename)) {
return $filename;
}
...
@leenooks why is this broken?
this line: https://github.com/igaster/laravel-theme/blob/master/src/Themes.php#L319
will call the Theme::url() which should return the correct value. Unless you didn't set some active theme. Is that your case?
Without my patch, when you have @js('https://my.javascript.url/to/a/jsfile') results it being rendered as a path, ie: <script src="https://my.web.url/https://my.javascript.url/to/a/jsfile"></script>