add new font in vuejs + tailwindcss project
- User
add new font in vuejs + tailwindcss project
- Assistant
To add a new font in a Vue.js + Tailwind CSS project, follow the steps below:
-
Download the font file (usually a .ttf or .otf file) and place it in your project's assets folder (e.g.,
src/assets/fonts). -
Open your project's
tailwind.config.jsfile and locate thethemekey. -
Inside the
themekey, add a newfontFamilyproperty and define a name for your font. For example:
module.exports = { theme: { extend: { fontFamily: { myFont: ['MyFontName', 'sans-serif'], }, }, }, // ... };Replace
'MyFontName'with the actual name of the font.-
Save the
tailwind.config.jsfile. -
Open your project's main component or the component where you want to use the new font.
-