Skip to content

Commit

Permalink
feat: text option (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardogobbosouza authored Feb 15, 2021
1 parent b142b02 commit 6ee0056
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
17 changes: 17 additions & 0 deletions docs/content/en/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = function (moduleOptions) {
families: {},
display: null,
subsets: [],
text: null,
prefetch: true,
preconnect: true,
preload: true,
Expand All @@ -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
Expand Down

0 comments on commit 6ee0056

Please sign in to comment.