Skip to content

Instantly share code, notes, and snippets.

@silenius
Created September 22, 2021 10:54
Show Gist options
  • Save silenius/a349566bb88c86c3bae5da5df04e55c6 to your computer and use it in GitHub Desktop.
Save silenius/a349566bb88c86c3bae5da5df04e55c6 to your computer and use it in GitHub Desktop.
export function site_url() {
const prefix = document.body.getAttribute('data-script_name');
let url = Array.prototype.slice.call(arguments);
url.splice(0, 0, prefix);
return url.join('/').replace(/\/{2,}/, '/');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment