Using Vite/React/Tailwind, I am trying to set dev/prod workflow so that images stored in 'public' directory has the correct path when deployed to gh-pages. Below is my Tailwind config starting point where 'backgroundImages' property is referencing an image file stored in 'public'.
module.exports = {
mode:'jit',
content: ["./src/**/*.{html,jsx}"],
theme: {
screens: {
sm: '480px',
md: '768px',
lg: '976px',
xl: '1440px',
},
colors: {
'splash-hex': '#6BD1D2',
'splash-rgba': 'rgba(107, 209, 210,1.0)',
'splash-hsla': 'hsla(181, 53%, 62%, 1.0)',
},
fontFamily: {
sans: ['Graphik', 'sans-serif'],
serif: ['Merriweather', 'serif'],
},
backgroundImages:{
'default':'url("./10475996-3x2-940x627.jpeg")'
},
extend: {
spacing: {
'128': '32rem',
'144': '36rem',
},
borderRadius: {
'4xl': '2rem',
}
}
},
prefix: 'tw-',
plugins: [],
}
In dev this works fine.
http://localhost:3000/10475996-3x2-940x627.jpeg
In 'dist' folder, it looks correct as well when 'build' is run.
When deployed to gh-pages, the path changes to /assets/
and the image is no longer served from root as I expected according to Vite.
https://unevenartwork.com/assets/10475996-3x2-940x627.jpeg
Is there a configuration that would suppress the /assets/
on deploy or another solution?