svelte-add: Tailwind's classes do not work in html elements (SvelteKit v1.0.0-next.102)
Hi, I was trying to get a clean installation of svelte-kit and tailwind I did
npm init svelte@next appName
npx svelte-add tailwindcss
npm i
The installation is ok, @apply
styles works as expected, but when I tried to use tailwind’s classes in the elements, the styles do not work, for example:
<p class='text-red-50'>test</p>
FYI
✔ Which Svelte app template? › R/ SvelteKit demo app
✔ Use TypeScript? … R/ No
✔ Add ESLint for code linting? … R/ Yes
✔ Add Prettier for code formatting? … R/ Yes
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 14
- Comments: 25 (10 by maintainers)
Apply the current version of this preset with
pnpx svelte-add tailwindcss --jit
.Create (or edit) a
src/routes/__layout.svelte
with these contents:and an
src/app.postcss
with these contents:I, too, am baffled by why this isn’t working as expected right now (without manual intervention). Slating this as something to fix with the rewrite and giving up on the existing preset because it’s somehow broken beyond repair.
This is a bug with this project attributed to the recent
$layout.svelte
->__layout.svelte
change in SvelteKit. Hold tight while I fix this.Not quite. I have some local / unpushed and uncommitted changes as I’ve been encountering obstacles.
🎉 This has been fixed! 🎉
Due to the current state of
svelte-add
, you may encounter a different issue when using this tool. Please feel free to find an existing issue at https://github.com/svelte-add/svelte-add/issues or open a new one for whatever problem you encounter.Thank you everyone for your patience and continued interest in the project!
Your colors are overriding the defaults rather than being added to them: https://tailwindcss.com/docs/customizing-colors#extending-the-defaults
For some reason I have noticed that although this issue appears to be fixed, it might not be. Adding custom colors to your tailwind config immediately breaks roughly half the styles in tailwind, and worse yet, even adding
still breaks it! Very strange bug worth investigating!
It seems to work with the default
followed by adding to
app.css