bnomei / kirby3-fingerprint

File Method and css/js helper to add hash to files
https://forum.getkirby.com/t/kirby-3-fingerprint-asset-cachebuster/23576
MIT License
37 stars 3 forks source link

Manifest file array - possible bug #25

Closed S1SYPHOS closed 3 years ago

S1SYPHOS commented 3 years ago

Hey there, since gulp-rev outputs paths without leading /, the key in $manifest (inside hash() function) isn't found:

$filename = basename(A::get(
    $manifest,
    $url,  # doesn't work, but
    # ltrim($url, '/') works
    # ltrim($url, DIRECTORY_SEPARATOR) obviously works as well
    $root
));
S1SYPHOS commented 3 years ago

With the PR, I went another way - instead of ltrimming, I used Url::path since you are transforming stuff internally to a URL - given that I reduce this to a path (= as the array keys in the manifest file are paths, not complete URLs), we could think about skipping this part - but that's ultimately up to you.

Cheers, S1SYPHOS