Skip to content
This repository has been archived by the owner on Jun 22, 2024. It is now read-only.

Do not use dynamic class names #55

Open
Thibaultfq opened this issue Jan 4, 2024 · 0 comments
Open

Do not use dynamic class names #55

Thibaultfq opened this issue Jan 4, 2024 · 0 comments

Comments

@Thibaultfq
Copy link

Hi,

I noticed that you used dynamic class names in your components. This is problematic because dynamic class names are not recognised by tailwind, and hence, not generated into the output css.

All the hover variables in colors.js are an example of that, but there are more such as focus:{{...}} or sm:{{...}}

Only solution is to have colors.js (and others ofc) reference only the full class names and remove modifiers such as hover:{{...}} or sm:{{...}} etc from source template files.
eg: colors.js

   navDefault: {
    barBg: 'sm:bg-white',
    textHover: 'sm:hover:text-red-900',
    mobileBg: 'bg-white',
    mobileBgActive: 'bg-red-500',
    mobileBgHover: 'hover:bg-red-100',
  }

see the tailwind documentation on this https://tailwindcss.com/docs/content-configuration#dynamic-class-names

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant