-
-
Notifications
You must be signed in to change notification settings - Fork 900
Serving web fonts
Shuanglei Tao edited this page Jun 26, 2023
·
2 revisions
It's possible to bundle web fonts to ttyd exetuable and use it, so that it won't need to be installed on the client side.
- add your own @font-face rules to index.scss, example:
@font-face { font-family: 'My Font'; font-style: normal; font-weight: normal; src: url(...); }
- apply the following patch (make sure you use a local path for
src
):--- a/html/webpack.config.js +++ b/html/webpack.config.js @@ -29,6 +29,10 @@ const baseConfig = { test: /\.s?[ac]ss$/, use: [devMode ? 'style-loader' : MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'], }, + { + test: /\.(ttf|otf|eot|woff|woff2)$/, + type: 'asset/inline', + }, ], }, resolve: {
- rebuild the html and ttyd.
start ttyd with -t "fontFamily=My Font"
.