Taking my first steps with sage 10 and tailwind. Following the documentation here - How to Setup Fonts | Sage Docs | Roots - to load in a font, but getting an error message. Also, as I go through that help page there are a couple of unclear items that would be good to clear up.
First of all, here is my error message.
Failed to find 'common/fonts'
│ in [
│ ./resources/styles
│ ]
And here is the setup.
Tailwind.config.cjs looks like:
// https://tailwindcss.com/docs/configuration
module.exports = {
content: ['./index.php', './app/**/*.php', './resources/**/*.{php,vue,js}'],
theme: {
extend: {
colors: {
'teal': '#005F72',
'navy': '#25303B',
'burntorange': '#A33216',
'peach': '#FBD1C3',
}, // Extend Tailwind's default colors
fontFamily: {
sans: ['Montserrat, sans-serif'],
},
},
},
plugins: [],
};
My app.css file looks like this :
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
/* FONTS */
@import 'common/fonts';
My styles/common/fonts.scss file looks like this
@font-face {
font-display: swap;
font-family: 'Montserrat', sans-serif;
font-style: normal;
font-weight: 400;
src: url('@fonts/Montserrat-Regular.woff2') format('woff2'),
}
//
@font-face {
font-display: swap;
font-family: 'ProximaNova', sans-serif;
font-style: normal;
font-weight: 400;
src: url('@fonts/ProximaNova-Regular.woff2') format('woff2'),
}
Question.
On the help document it advises you:
‘Define your @font-face
in styles/common/fonts.css
:’
So should I actually have created a .css file in here? I tried it but that also failed. But if this is actually supposed to be a css file here Im probably missing some quite fundamental understanding on how the whole thing hands together
The other confusing item in the help is:
‘Configure theme.json
to use the font’
But at the top of the theme.json file it says
’ “generated”: “ This file is generated. Do not edit.”,’
So where should we edit the information which goes into this?
Any help much appreciated!