I would like my whole site to use a monospaced font. Is there an easy way to do that?
I tried downloading this font, and placed it in a couple of places in my project, but I can’t get it to load. I tried placing the .ttf files under /assets/fonts, and /priv/static/fonts, and /fonts at the root. No luck.
My tailwind.config.js looks like this:
module.exports = {
content: [
"./js/**/*.js",
"../lib/my_api2_web.ex",
"../lib/my_api2_web/**/*.*ex"
],
theme: {
fontFamily: {
primary: ["AnonymousPro"]
},
extend: {
colors: {
brand: "#FD4F00",
}
},
},
And where I’m trying to use the font:
<main class="font-primary">
<%= @inner_content %>
</main>
Here’s my app.css file:
@import "fonts.css";
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";
And a new file, fonts.css, in the same folder as app.css:
@font-face {
font-family: 'anonymous_pro';
font-weight: 100 900;
font-display: swap;
font-style: normal;
src: url("/fonts/AnonymousPro-Regular.ttf");
}
I followed the instructions over here, but that might be outdated by now? I’m not sure.
I’m using Phoenix 1.7.11.