Skip to content

Instantly share code, notes, and snippets.

@aashreys
Created November 29, 2022 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aashreys/48a0206f545e775b8aedbc67e9027d7b to your computer and use it in GitHub Desktop.
Save aashreys/48a0206f545e775b8aedbc67e9027d7b to your computer and use it in GitHub Desktop.
Check if a Figma URL is that of the current file
export function isThisFile(url: string): boolean {
let formattedFilename = figma.root.name.trim()
formattedFilename = encodeURIComponent(formattedFilename).replace(/%20/g, '-')
let isThisFile = url.includes('figma.com') && url.includes(formattedFilename)
return isThisFile
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment