#About background images & fonts
154 messages · Page 1 of 1 (latest)
i'll add details in 3 mins
i tried to do this ```:root {
background-color: #323232;
font-family: Gilroy;
background-image: url('images/bgpattern.png')
}```
from app.scss
i tried to import app.scss from app.html
i guess i need to import app.scss to my main file which is electron.cjs
but i cant, and dont know how to do
(i'm a beginner)
i dont think we able to help you with stelve
but path is definetly wrong
hmm, but why is it working with dev mode
you can check in devtools
well such frameworks are differ with dev and prod
I suppose you have some system to resolve paths in prod or something
But I don't know anything about Svelte either
lol its pretty weird
i have tens of images in that folder
but it only cant resolve this one
left one is devtools
right one is vs
check paths
Ctrl + R
something like electron.restart?
oh lol
window.location.reload()
window.location.reload()
a min
open the network tab before reloading
this is not a electron problem
from where app:// comes from?
you have protocol bridge?
app://-/_app/immutable/assets/Gilroy-Medium.ttf
yep
for anyone wondering with svelte how to fix this
it fixed using '../../static/images/bgpattern.png' instead of '/images/bgpattern.png'
in my opinion this is pretty absurd
i dont know why svelte doesnt do this automatically..
becase stelve dont know it
thats 100% sveltes problem, then right?
i found something like this
plugins: [sveltekit()],
resolve: {
alias: {
$img: mode === "production" ? "./static/img" : "../img",
},
},
}));
50/50
this can be useful for everyone, i was not able to implement to my code but if anyone needs it
whats wrong with electron on this situation?
ah yeah thats true
web requests and file path handled differently
and may i ask
why these two files
and not others?
because it uses 'background-image' property in css?
and if i create a div and make it w-full h-full and put a image in it
it will fix the problem
but is it good hing to make?
you use vite?
yep
have you configured the base option?
not really
You have to set base: "./" for assets to be loaded correctly in prod
On Vite config
what others use?
they get files from app://-/images/discord.png
but the borken ones gets from app://-/_app/immutable/assets/Gilroy-Medium.ttf
i guess its because css is fetching it
and not a element
it needs to get images from images folder
but it goes to _app
and goes to immutable
assets folder
try to set the base..
probably becase html and css are in different places
If you are deploying your project under a nested public path, simply specify the base config option and all asset paths will be rewritten accordingly. This option can also be specified as a command line flag, e.g. vite build --base=/my/public/path/.
JS-imported asset URLs, CSS url() references, and asset references in your .html files are all automatically adjusted to respect this option during build.
yeah, i did that
let me re check because i probably did it wrong
base: "./static/",
k, im building with './' rn
unless you use a special folder structure or something, maybe
i dont know sctructure of electron
but its prolly a custom
because similar to svelte
ill try both
electron itself have no structure
lol
literally
and yeah, if someone reads this thread
you need to put paths: { base: './' }
to svelte config
Did it work?
well no
this thing wants to fetch images from app://-/_app/immutable/assets/images/bgpattern.png so bad
what if i get images to this folder?
lmao
Maybe it's a Svelte problem then 🤷♀️
100%
now im going svelte support guy to explain my problem from scratch
and just wait
thanks to everyone for helping
@quaint willow sorry for distrubing
but i found out why..
i dont need to change anything
just instead of images/blabla.png
/images/blabla.png
thats it..
yeah
