Comments (3)
In extension
's special pages(like popup and options), you can do this simply:
<style>
@font-face {
font-family: 'Fira Code';
src: url('/assets/FiraCode-Regular.ttf') format('truetype');
}
.font {
font-family: 'Fira Code';
}
</style>
But in content-script
, you need to specify the font assets full path:
@font-face {
font-family: 'Fira Code';
src: url('chrome-extension://ocihbmcjobflnakhfpiedhbiafbbdgfo/assets/FiraCode-Regular.ttf') format('truetype');
}
and make the assets are accessible via src/manifest.ts
:
const manifest: Manifest.WebExtensionManifest = {
//...
web_accessible_resources: [
'assets/FiraCode-Regular.ttf',
],
}
There are two more tips:
- If you don't know the extension id or want to make it flexible, you can call
browser.runtime.getURL('assets/FiraCode-Regular.ttf')
to get the full path. - Just embedded the font file in CSS by base64 data URL
from vitesse-webext.
Does @font-face meet your requirements?
or Google Fonts
from vitesse-webext.
Yeah I want to use @font-face and host the fonts with my extension. I just don't know how to load them with this webext starter template.
I have put fonts in an /assets
folder, but simply referencing them in the css file doesn't work, so there's probably some config to make with windi, but I can't figure out how.
from vitesse-webext.
Related Issues (20)
- Vite server did not start HOT 3
- The options page will display an error after using vue-i18n HOT 3
- Fix HMR in contentScript App by using an iframe HOT 1
- React port of Vitesse-webext HOT 1
- insecure sources are not allowed in content_security_policy.extension_pages (Firefox) HOT 1
- community version that supports Manifest V3 HOT 2
- [webext-bridge] No handler registered in 'content-script' to accept messages with id 'get-name' HOT 1
- Vue.js not detected by Vue dev tools HOT 1
- Why new tab 'Document' is opened on startup? HOT 1
- Vite Server did not start - error when zipping and trying on another pc HOT 1
- Invalid assets URL in dev mode HOT 5
- e2e basic tests fails HOT 2
- Reactive storage infinite loop caused by race conditions HOT 2
- element-plus styles lose HOT 5
- Popup & Option doesn't work when after build. HOT 3
- Vite server did not start HOT 1
- error on openOptionsPage HOT 7
- docs: update components README plugin name and link HOT 1
- Sidepanel example HOT 5
- How to change the element plus class namespace HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vitesse-webext.