#Why is the font I configured not displaying?

1 messages · Page 1 of 1 (latest)

plucky kayak
#
#![allow(non_snake_case)]

use dioxus::prelude::*;
use crate::pages::HomePage;

const _TAILWIND_URL: &str = manganis::mg!(file("public/tailwind.css"));
const STYLE: &str = manganis::mg!(file("src/styles/main.css"));


#[component]
pub fn App() -> Element {
    rsx! {
        link { rel: "stylesheet", href: STYLE }
        HomePage {}
    }
}
#
body {
    background-color: #F4F4F4;
    font-family: "JetBrainsMono";
    overflow-x: hidden;
}
#
@tailwind base;
@tailwind components;
@tailwind utilities;

@font-face {
    font-family: "JetBrainsMono";
    src: local("JetBrainsMonoNL-Regular"),
    url("./src/assets/fonts/JetBrainsMonoNL-Regular.ttf") format("ttf");
}
chrome burrow
#

Your assets in src/assets could go under public as well, then dx serve will serve your assets alongside your app

#

Then you can change your CSS to something like:

#
@font-face {
    font-family: "JetBrainsMono";
    src: local("JetBrainsMonoNL-Regular"),
    url("/public/fonts/JetBrainsMonoNL-Regular.ttf") format("ttf");
}