0

I'm trying to port a Chrome extension Firefox add-on using the WebExtensions API . In chrome extension I am using

src: url('chrome-extension://__MSG_@@extension_id__/css/fonts/webFonts/font-awesome/fontawesome-webfont.eot?v=4.5.0');

to include fonts. What should I use in Firefox WebExtension?

Since I can't use browser.extension.getURL() in a CSS file, how can I use @font-face with a local font file?

Shweta Matkar
  • 301
  • 1
  • 11

2 Answers2

2

Use "moz-extension://..."

src: url('moz-extension://__MSG_@@extension_id__/css/fonts/webFonts/font-awesome/fontawesome-webfont.eot?v=4.5.0');
0

You can turn it into a data uri with this: http://dopiaza.org/tools/datauri/index.php then your css would look like src:("data:application/font-woff;base64,.....") format("woff");

I do this here -

https://github.com/Noitidart/NativeShot/blob/32d3bd62bb217b9d5a72fea29d41a426b158bdac/resources/styles/editor.css#L651

Noitidart
  • 35,443
  • 37
  • 154
  • 323