-
Notifications
You must be signed in to change notification settings - Fork 364
Add custom fonts to slate 1.x #418
Comments
Hey @pveen2 -- you'll need to declare the
and then reference you font as normal in your
Does that work for you? Related: #410 |
Yes @t-kelly, thanks. I thought I already reply. But thanks! |
It's not working for me unfortunately, the "assets/fonts" folder is being ignored. |
I've been wrestling with loading fonts for awhile. The only way I can get this to deploy, is by using
Here's my code in <style>
@font-face {
font-family: 'GT America Condensed';
src: url("{{ '../assets/fonts/GTAmerica-CondensedBold.woff2' | global_asset_url }}") format('woff2'),
url("{{ '../assets/fonts/GTAmerica-CondensedBold.woff' | global_asset_url }}") format('woff');
font-weight: bold;
font-style: normal;
}
</style> The lack of clear documentation around assets is really getting frustrating. |
Sounds like this needs to be reopened. I'll take a look as soon as I have the chance! |
For those looking to solve this today, you can reference web font files from My const path = require('path');
const alias = {
'lodash': path.resolve('./node_modules/lodash-es'),
'scripts': path.resolve('./src/assets/scripts'),
'styles': path.resolve('./src/assets/styles'),
'fonts': path.resolve('./src/assets/fonts'),
};
module.exports = {
slateTools: {
extends: {
dev: {
resolve: {alias}
},
prod: {
resolve: {alias}
},
},
}
}; My @font-face {
font-family: 'Danzza';
src: url('~fonts/Danzza-Medium.woff');
font-weight: 500;
font-style: normal;
}
@font-face {
font-family: 'Windsor';
src: url('~fonts/Windsor-Roman.woff');
font-weight: 400;
font-style: normal;
}
@font-face {
font-family: 'Suisse';
src: url('~fonts/SuisseIntlMono-Regular.woff');
font-weight: 400;
font-style: normal;
} |
Assets have been simplified in #850 and the change is now available in v1.0.0-beta.12 Docs that have also been updated: |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Problem
In the folder src/assets/fonts i added a custom font so an eot, woff & woff2 file. But i can't use them with the SCSS files
Is there a workaround to add them to the scss?
The text was updated successfully, but these errors were encountered: