diff --git a/docs/content/en/options.md b/docs/content/en/options.md index 4b0647a..433efea 100644 --- a/docs/content/en/options.md +++ b/docs/content/en/options.md @@ -52,6 +52,23 @@ googleFonts: { } ``` +## text + +Oftentimes, when you want to use a web font on your site or application, you know in advance which letters you'll need. +This often occurs when you're using a web font in a logo or heading. See https://developers.google.com/fonts/docs/css2#optimizing_your_font_requests + +In these cases, you should consider specifying a [text](https://developers.google.com/fonts/docs/css2#optimizing_your_font_requests). +This allows Google Fonts to return a font file that's optimized for your request. In some cases, this can reduce the size of the font file by up to 90%. + +Type: String +Default: null + +```js{}[nuxt.config.js] +googleFonts: { + text: 'Hello world' +} +``` + ## prefetch This option injects [dns-prefetch](https://developer.mozilla.org/en-US/docs/Web/Performance/dns-prefetch) into the head of your project. diff --git a/lib/module.js b/lib/module.js index 1bb6d51..967ecac 100644 --- a/lib/module.js +++ b/lib/module.js @@ -8,6 +8,7 @@ module.exports = function (moduleOptions) { families: {}, display: null, subsets: [], + text: null, prefetch: true, preconnect: true, preload: true, @@ -28,7 +29,8 @@ module.exports = function (moduleOptions) { const googleFontsHelper = new GoogleFontsHelper({ families: options.families, display: options.display, - subsets: options.subsets + subsets: options.subsets, + text: options.text }) // merge fonts from valid head link