diff --git a/fontScript/index.js b/fontScript/index.js new file mode 100644 index 0000000..2b01f7f --- /dev/null +++ b/fontScript/index.js @@ -0,0 +1,23 @@ +(async () => { + const website = "https://example.tld/"; // Replace with the URL of the website + const pathToCss = "path/to/css"; // Replace with the path to the CSS file + const cssUrl = website + pathToCss; + + try { + // Fetch the CSS file + const response = await fetch(cssUrl); + const cssText = await response.text(); + + // Use a regular expression to extract the font file path + const fontMatch = cssText.match(/url\(['"]?(.*?web-font\.(otf|ttf|woff|woff2|eot))['"]?\)/); + + if (fontMatch && fontMatch[1]) { + const resolvedFontPath = new URL(fontMatch[1], cssUrl).href; // Resolve relative path + console.log(`Found font URL: ${resolvedFontPath}`); + } else { + console.log('Font not found in the CSS file.'); + } + } catch (error) { + console.error('Error fetching or parsing the CSS file:', error); + } +})(); \ No newline at end of file