Is there any way to add to the index file to include Google Fonts?
Totes - 3 options for this that I'm aware of.
// index.js
import './style/index.css';
/* style/index.css */
@import url('//fonts.googleapis.com/css?family=Open+Sans');
// index.js
export default () => (
<div class="app">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans" />
{/* regular app stuff here */}
</div>
);
preact build --html-template my-template.html
3.1 - you can also set the template from
preact.config.js:// preact.config.js in your repo root export default (config, env, helpers) => { helpers.setHtmlTemplate(config, 'src/index.html'); };
The only issue with --html-template is that if preact-cli updates need a new template, you'll still have your custom one. If you can use VDOM to render the fonts, that'll be better.
Nice - thanks for taking time to show the options. Works great.
Most helpful comment
Totes - 3 options for this that I'm aware of.
The only issue with --html-template is that if preact-cli updates need a new template, you'll still have your custom one. If you can use VDOM to render the fonts, that'll be better.