public static function resolve(string $filename, string $basePath = ''): string
    {
        if (strpos($filename, '://')) {
            //Absolute path
            return $filename;
        }

        $localFilename = directory('public') . $filename;

        //Add query parameter to uniquely identify file version
        if (is_file($localFilename) && file_exists($localFilename)) {
            $filename .= '?' . hash('crc32', filemtime($localFilename));
        }

        return str_replace('//', '/', $basePath . $filename);
    }