Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include ttf files in chrome extension content script

I am using a content script to inject some HTML into a webpage. I am trying to use the google font, CabinCondensed-Regular, and a number of icon fonts gotten from IcoMoon. I have downloaded the files and am including them in the CSS with @font-face, because from what I can tell it's faster, but I don't know how to include them in the manifest.json. Normally you could specify a file by "content_scripts": [

{
    "matches": [ "<all_urls>"],
    "css":["style.css", "jquery-ui.css"],
    "js":["jquery-2.1.0.min.js", "index.js", "jquery-ui.min.js"],
}

but as far as I can tell there is no specific tag for fonts, so how can I include the ttf files?

like image 464
EasilyBaffled Avatar asked Feb 13 '23 07:02

EasilyBaffled


1 Answers

Looks like you can use "web_accessible_resources" to link your font files (instead of "content_scripts". Then just make sure your @font-face path is correct to the font files. See: https://developer.chrome.com/extensions/manifest/web_accessible_resources

like image 153
Akurn Avatar answered Feb 15 '23 20:02

Akurn