A universal shortcode to optimize Google Fonts for eleventy.js. This shortcode download and inline Google Font's CSS.
npm install eleventy-google-fonts --save-dev
const eleventyGoogleFonts = require("eleventy-google-fonts");
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(eleventyGoogleFonts);
};
<head>
...
{% eleventyGoogleFonts 'https://fonts.googleapis.com/css2?family=Overpass:wght@600&display=swap' %}
...
</head>
This code is available under the MIT license.