Theme function is not working properly. #2666
-
Tailwindcss v. 1.9.5 First of all, I am almost sure that it is not a bug, but that I am doing something wrong, I just can't find the problem. Let me show you what I'm trying to do. My config file look like this:
My CSS file looks like this and do not work to generate some classes if I use the
And this is my laravel mix file
When running the Another thing that happens is that when I add a new font, as standard fonts defined by the framework stop working, a mono font for example. Can you tell me what I'm doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Hey @Babiute! Here's what's happening: you have defined your colors immediately in the If you want to extend the theme colors, you need to define your new colors inside the // tailwind.config.js
module.exports = {
future: {
// removeDeprecatedGapUtilities: true,
// purgeLayersByDefault: true,
},
purge: [],
theme: {
+ extend: {
colors: {
pattern: {
100: 'var(--color-100)',
200: 'var(--color-200)',
300: 'var(--color-300)',
400: 'var(--color-400)',
500: 'var(--color-500)',
600: 'var(--color-600)',
700: 'var(--color-700)',
800: 'var(--color-800)',
900: 'var(--color-900)',
},
},
}
fontFamily: {
'logo': ['Monoton','Bungee Shade','Sirin Stencil'],
},
+ },
variants: {},
plugins: [],
} Sice you overrode the default theme colors, You can read about the difference between overriding and extending the default theme here: https://tailwindcss.com/docs/theme#overriding-the-default-theme Here's a little Tailwind Play setup of your config/CSS working: https://play.tailwindcss.com/RarBzP2wxI Hope it helps! 👍 |
Beta Was this translation helpful? Give feedback.
-
Hey @simonswiss . |
Beta Was this translation helpful? Give feedback.
-
@simonswiss Everything is working fine on a new project. Looks like there is something wrong with my old project. thx for your help. |
Beta Was this translation helpful? Give feedback.
Hey @Babiute!
Here's what's happening: you have defined your colors immediately in the
theme
, under thetheme.colors
key. When you do that, you essentially completely replace the theme colors by overriding the default theme.If you want to extend the theme colors, you need to define your new colors inside the
extend
property -theme.extend.colors
, like you did for extending the font family// tailwind.config.js module.exports = { future: { // removeDeprecatedGapUtilities: true, // purgeLayersByDefault: true, }, purge: [], theme: { + extend: { colors: { pattern: { 100: 'var(--color-100)', 200: 'var(--color-200)', 300: 'var(--colo…