I am new in Gatsby and I am using tailwind css with postcss. Some of the color configurations I defined in theme object of tailwind.config.js is working in dev environment but not in production. I have tried cleaning cache and deleting public folder and re-building it. That did not solve the problem. My theme object in tailwind.config.js is like this:
theme: {
colors: {
transparent: 'transparent',
current: 'currentColor',
primary: {
DEFAULT: '#4F9C3A',
900: '#25441c',
},
secondary: {
0: '#ff9563',
DEFAULT: '#E66437',
9: '#ae3409',
},
footer: {
light: '#e66437',
DEFAULT: '#383e42',
dark: '#26292c',
},
neutral: {
0: '#ffffff',
DEFAULT: '#ffffff',
1: '#fafafa',
9: '#000000',
},
accent: {
1: '#388ac5',
DEFAULT: '#293842',
},
brown: {
DEFAULT: '#C9AC75',
2: '#44261c',
},
black: '#000000',
}
}
UPDATE: I have been able to pinpoint source of the problem. I am fetching which class names to apply from a json file using gatsby-transformer-json. I have something like the following code segment to set background color which is working in development environment but not in production.
<div className={`bg-${color}>
The development build shows proper background color for this segment but production build does not.
</div>