Tailwind CSS Background-image can't display even after I putt the jpg file into /public dir
Answered
Chartreux posted this in #help-forum
ChartreuxOP
.bg-cuteCat {
background-image: url('/cuteCat.jpg');
}this is the inlay hints after I set up the configuration , but the next.js can't read the file , but also it does not pop up an error
PS C:\Users\Shiha\Desktop\talpx\public> ls
Directory: C:\Users\Shiha\Desktop\talpx\public
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 10/18/2023 10:32 PM 811464 cuteCat.jpg
-a---- 10/10/2023 3:15 PM 1375 next.svg
-a---- 10/10/2023 3:15 PM 629 vercel.svgAnswered by joulev
ah yes that's exactly the problem. you can use a matcher/middleware
if conditionals to exclude requests that end with jpg4 Replies
@joulev can you access `localhost:3000/cuteCat.jpg`?
ChartreuxOP
I think I might know where the problem comes from , I set an middleware auto redirect , "localhost:3000/cuteCat.jpg" will redirect to "localhost:3000/en/cuteCat.jpg" , so I should let Middleware omit redirects the public path ?
@Chartreux I think I might know where the problem comes from , I set an middleware auto redirect , "localhost:3000/cuteCat.jpg" will redirect to "localhost:3000/en/cuteCat.jpg" , so I should let Middleware omit redirects the public path ?
ah yes that's exactly the problem. you can use a matcher/middleware
if conditionals to exclude requests that end with jpgAnswer
@joulev ah yes that's exactly the problem. you can use a matcher/middleware `if` conditionals to exclude requests that end with `jpg`
ChartreuxOP
👠Thx again , you help me a lot