-
Notifications
You must be signed in to change notification settings - Fork 177
support images and fonts url() in css #788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
mbostock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I do think we’ll want to figure out how to treat these as assets that get included in the build (and added to _file or _import and content-hashed so it can be immutably cached). We should be able to mark these as external and then add them to the build, rewrite the relative paths, somehow?
(hashes provided for free by esbuild)
this is in order to remove the misleading messages from esbuild, because the developer cannot mark these assets as external.
|
related #423 |
mbostock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should change this so that importing in CSS produces the same result as linking to a static asset in HTML (i.e., it goes in _file).
(This includes images and fonts using url().) Using onResolve (as suggested in #786 (comment)) closes #786 supersedes #788
|
superseded by #1372 😓 |
closes #786
here's an example application (which I wouldn't necessarily recommend!) with a background image from docs/assets/ and fonts saved in docs/fonts/:
You can also use static assets to modify the toggle or caret with the docs/toggle.svg file :
The resources are inlined in text (for svg) base64 (for binary images and fonts), so use with some caution. Note that inlining fonts avoids FOUC, and the style.css is cached, so it's not necessarily bad. Just put these definitions at the bottom of stylesheet? The alternative is to use absolute URLs to an assets server.I'm working on saving these as assets.