framework icon indicating copy to clipboard operation
framework copied to clipboard

Add mix.version() support

Open jlambe opened this issue 5 years ago • 2 comments

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

jlambe avatar Mar 22 '19 09:03 jlambe

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, '?'), '\/');

...

KevinBatdorf avatar Mar 22 '19 09:03 KevinBatdorf

If we want to override the $ver with the id from mix though it looks like it will require some refactoring.

KevinBatdorf avatar Mar 22 '19 09:03 KevinBatdorf