Leptos + Tailwind + Custom fonts #669
-
I am trying to use custom fonts with the Leptos template. I have added the following options in the # The tailwind input file.
#
# Optional, Activates the tailwind build
tailwind-input-file = "styles/tailwind.css"
# The tailwind config file.
#
# Optional, defaults to "tailwind.config.js" which if is not present
# is generated for you
tailwind-config-file = "tailwind.config.js" All the files present in the "asset" folder are served correctly: Some of those files are fonts and I can download them like this(notice there is no "pkg" part in the url): I am trying to use one of the font like this in my css (this is my @tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
@font-face {
font-family: cooper hewitt;
font-style: normal;
font-weight: 700;
src: local('Cooper Hewitt'), url(fonts/CooperHewitt-Bold.woff) format('woff')
}
} and this fails because it calls I am pretty sure that the css function My guess is someone here has already figured out how to deal with this problem. Update/ maybe a solution ()?():Found no information to confirm it but it seels that the css function
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The issue you're facing is that the url() in your Tailwind CSS file is resolving relative to the location of the CSS file, which includes the /pkg part.
@font-face { |
Beta Was this translation helpful? Give feedback.
The issue you're facing is that the url() in your Tailwind CSS file is resolving relative to the location of the CSS file, which includes the /pkg part.
@font-face {
font-family: 'Cooper Hewitt';
font-style: normal;
font-weight: 700;
src: local('Cooper Hewitt'), url('/fonts/CooperHewitt-Bold.woff') format('woff');
}