Skip to content

Conversation

fry69
Copy link
Contributor

@fry69 fry69 commented Oct 5, 2025

This adds a short clarification how imported assets vs. static files get handled now with Vite to the existing documentation for static files.

@CAYdenberg
Copy link
Contributor

I tried this out based on the issue mentioned in #3482 and it didn't seem to work. A font referenced from a CSS url() wasn't found by Vite when running deno task dev, but it did work when running deno task build. Maybe I'm doing something wrong.

@fry69
Copy link
Contributor Author

fry69 commented Oct 6, 2025

@CAYdenberg This works for me with deno task dev and in a production build (using the demo app with Tailwind enabled):

/* assets/styles.css */
@import "tailwindcss";

@font-face {
  font-family: "Roboto";
  src: url("/Roboto-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

body {
  font-family: "Roboto", sans-serif;
}

The Roboto-Regular.ttf is inside static/. I can turn the font on and off in the browser inspector.

@CAYdenberg
Copy link
Contributor

I think my confusion stems from:

Files imported in code (CSS, fonts, icons, etc.) → Place outside static/

In this case though, the fonts themselves (not the CSS referring to the fonts) should be in static

@fry69
Copy link
Contributor Author

fry69 commented Oct 6, 2025

@CAYdenberg Should be fixed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants