matyunya / smelte

UI framework with material components built with Svelte and Tailwind CSS

Home Page:https://smeltejs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

purge does not include class needed by Switch component

i8ramin opened this issue · comments

Look like the tailwind purge process removes some classes needed by the Switch component. Namely .bg-primary-200 (defined here

all: color => [`bg-${color}-200`, `bg-${color}-400`]
)

I am guessing b/c the classname is being added dynamically using a variable. What is the best way to fix this? I tried setting whitelistPatterns in the config, but that didn't seem to work:

whitelistPatterns: [/\.bg-/]

I was able to get around this by setting the following whitelist: ['bg-primary-200', 'bg-primary-400'] ... but would rather not hardcode it in the config

Hi, with the latest update (1.1.5) this seems to no longer work. I have whitelist: ['bg-primary-200', 'bg-primary-400'] but when I do a production build, the Switch component does not display properly. Example below.

Screen Recording 2021-03-15 at 09 58 59 AM

I can see the classnames being added, but the styles are missing. I wonder, does this happen with other components that define variants the same way?