framework
framework copied to clipboard
Add mix.version() support
Current implementation of the asset finder does not support relative paths with query parameters.
The given relative path is used to locate an asset on the filesystem. The finder should ignore query parameters for relative paths and only use it to setup its URL.
Because of this, we can't use the mix.version()
feature.
Asset::add('theme', mix('css/theme.css')), [], $theme->getHeader('version'))->to('front');
// If compiled for production, will failed
// Path returned by the current mix helper:
css/theme.css?id=b4382rbd4738
I think the easiest way to get this working now is just to remove any query vars, as they aren't needed anyway.
// Asset/Finder.php
...
$path = trim(strtok($path, '?'), '\/');
...
If we want to override the $ver with the id
from mix though it looks like it will require some refactoring.