can't add custom fonts using addBase function as a tailwind plugin #557
-
Hi. i just recently switched from a plain Tailwind on NextJS to this. those i knew that this problem can easily solve by using Thanks. // tailwind.config.js
module.exports = {
theme: {
fontFamily: {
sans: ['NotoSans']
}
},
plugins: [
require('@tailwindcss/forms'),
require('@tailwindcss/line-clamp'),
require('@tailwindcss/aspect-ratio'),
...require('./plugins')
]
} // plugins/index.js
module.exports = [require('./font-face'), require('./global')] // plugins/font-face.js
const plugin = require('tailwindcss/plugin')
module.exports = plugin(({ addBase }) => {
addBase({
'@font-face': {
fontFamily: 'NotoSans',
fontWeight: 400,
fontStyle: 'normal',
src: `url('./font/NotoSans/NotoSans-Regular.ttf')`
}
})
} // plugins/global.js
const plugin = require('tailwindcss/plugin')
module.exports = plugin(({ addBase }) => {
addBase({
body: {
color: 'red'
}
})
}) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey there, Twins |
Beta Was this translation helpful? Give feedback.
Hey there,
Twins
GlobalStyles
import adds the plugins you've defined withaddBase
.But right now there's a problem defining @font-face within tailwind plugins using
addBase
- fix is in #563 which I'll push soon.Until then, add it temporarily with emotions globalStyles import.