I'm working on a project where the project calls for switchable themes for each user.
I can create multiple CSS files and run build on them but....before Laravel 9, i could do this by using an if condition using the authenticated user and adding the relevant CSS files within the condition but in vite as all CSS files are called in vite([...]) in the layout file & in the vite.config.js file i'm not sure how best to switch this.
I was thinking of doing an if condition with different css files in vite([...]) but thought maybe someone knows of a better way?
The only thing is, DaisyUI looks to store in local storage which would be cleared once the user leaves the site & i'm looking to store the users choice in the DB and serve the relevant CSS file based on their choice as i'm not primarily using tailwind.
Thanks @sinnbeck, i see what you're getting at....
Looking at the github docs and using your suggesting, adding the following to all of the CSS classes then changes the styling accordingly upon refresh when the user selects a different theme.
Looks like i've got some work to do standardising and adding classes. This does mean a much larger CSS file being called the more styles are added. I imagine this will increase load times but hope minifying the CSS file helps to reduce that.
In the end to keep the code cleaner i ended up creating a base file with all of the styling and then creating separate light / dark etc css files which targets the colours only.