fonts not getting applied in production build #3854
-
Hi there, I'm also using classnames, where is use something like const classNames = classnames(className, {
[`font-${family}`]: true,
[`font-${type}-${size}`]: true,
[`font-${weight}`]: true,
[`font-${type}-base`]: true,
}); Here all other are custom classes. tailwind.config.css module.exports = {
purge: ['./src/**/*.{js,jsx,ts,tsx}', './public/index.html'],
darkMode: false, // or 'media' or 'class',
theme: {
fontFamily: {
serif: ['Merriweather', 'serif'],
sans: ['Poppins', 'sans-serif'],
},
},
variants: {
extend: {},
},
plugins: [],
}; As you can see on the screenshot, class applied is |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Some ideas: Could be something about the font files. Is Merriwether available in the production build? Could be something about the cascade. Don't know what your Could be PurgeCSS. When using a dynamic class like |
Beta Was this translation helpful? Give feedback.
Some ideas:
Could be something about the font files. Is Merriwether available in the production build?
Could be something about the cascade. Don't know what your
font-display-
classes do. If you remove them is it still Poppins?Could be PurgeCSS. When using a dynamic class like
font-${family}
there's no guarantee that the class will be included in the production stylesheet. https://tailwindcss.com/docs/optimizing-for-production#writing-purgeable-html