-
Notifications
You must be signed in to change notification settings - Fork 87
Open
Description
Issue is this - when I try to serve a local font file from a css file I get 404 errors all around
in css
@font-face {
font-family: "Lato";
font-style: normal;
font-weight: 900;
font-display: swap;
src: url("@/css/fonts/lato-v20-latin-ext_latin-900.woff2")
format("woff2");
src: local(""),
url("@/css/fonts/lato-v20-latin-ext_latin-900.woff") format("woff"),
/* Modern Browsers */
url("@/css/fonts/lato-v20-latin-ext_latin-900.ttf")
format("truetype"); /* Safari, Android, iOS */
}
vite.config
export default defineConfig({
base: "static/", // match STATIC_URL from django
resolve: {
alias: {
"@": resolve("./static")
}
},
build: {
manifest: "manifest.json",
outDir: resolve("./assets"),
rollupOptions: {
input: {
test: resolve("./static/js/main.js"),
},
},
},
plugins: [tailwindss()]
});
settings.py
STATIC_URL = "static/"
MEDIA_URL = "/images/"
DJANGO_VITE = {"default": {"dev_mode": DEBUG}}
STATICFILES_DIRS = [
BASE_DIR / "assets",
BASE_DIR / "static",
]
STATIC_ROOT = BASE_DIR / "staticfiles"
MEDIA_ROOT = BASE_DIR / "static/images"
main.js
import "@/css/styles.css";
When I try to load the font I see that the url is /static/static/css/fonts
while it needs to be /static/css/fonts
What am I doing wrong?
Metadata
Metadata
Assignees
Labels
No labels