Skip to content

Commit

Permalink
docs: add content docs
Browse files Browse the repository at this point in the history
docs: add content docs
  • Loading branch information
debs-obrien committed Dec 3, 2020
1 parent dcf2823 commit 2feffa4
Show file tree
Hide file tree
Showing 17 changed files with 10,160 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# Create one with no scope selected on https://github.com/settings/tokens/new
GITHUB_TOKEN=
11 changes: 11 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules
*.iml
.idea
*.log*
.nuxt
.vscode
.DS_Store
coverage
dist
sw.*
.env
27 changes: 27 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# docs

## Setup

Install dependencies:

```bash
yarn install
```

## Development

```bash
yarn dev
```

## Static Generation

This will create the `dist/` directory for publishing to static hosting:

```bash
yarn generate
```

To preview the static generated app, run `yarn start`

For detailed explanation on how things work, checkout [nuxt/content](https://content.nuxtjs.org) and [@nuxt/content theme docs](https://content.nuxtjs.org/themes-docs).
132 changes: 132 additions & 0 deletions docs/content/en/downloading.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
---
title: Downloading Fonts
description: 'Downloading fonts option to enhance your Google Fonts module for Nuxt'
position: 4
category: Guide
---

## download

With this option you can download css and google sources for your local project. This means that your project will not depend on these external resources.

Type: Boolean
Default: false

```js{}[nuxt.config.js]
googleFonts: {
download: true
}
```


## base64

This option encodes the fonts and inject directly into the generated css file.

Type: Boolean
Default: true

```js{}[nuxt.config.js]
googleFonts: {
download: true,
base64: true
}
```

## inject

This option injects the [globally generated css](https://nuxtjs.org/api/configuration-css/) file.

Type: Boolean
Default: true

```js{}[nuxt.config.js]
googleFonts: {
download: true,
base64: true
}
```

## overwriting

This option prevents files from being downloaded more than once.

Type: Boolean
Default: false

```js{}[nuxt.config.js]
googleFonts: {
download: true,
overwriting: false
}
```

## outputDir

Specifies the output directory for downloaded files.

Type: String
Default: this.options.dir.assets

```js{}[nuxt.config.js]
googleFonts: {
download: true,
outputDir: this.options.dir.assets
}
```

## stylePath

Specifies the output directory for downloaded files.

Type: String
Default: 'css/fonts.css'

```js{}[nuxt.config.js]
googleFonts: {
download: true,
stylePath: 'css/fonts.css'
}
```

## fontsDir

Specifies the directory where the fonts will be downloaded.

<alert type="info">

This option is used if the base64 option is disabled.

</alert>

Type: String
Default: 'fonts'

```js{}[nuxt.config.js]
googleFonts: {
download: true,
base64: false,
fontsDir: 'fonts'
}
```

## fontsPath

Specifies the path of the fonts within the generated css file.

<alert type="info">

This option is used if the base64 option is disabled.

</alert>

Type: String
Default: '~assets/fonts'

```js{}[nuxt.config.js]
googleFonts: {
download: true,
base64: false,
fontsPath: '~assets/fonts'
}
```
28 changes: 28 additions & 0 deletions docs/content/en/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: Introduction
description: ''
position: 1
category: ''
features:
- Specify fonts by name/variant
- Parse head links to Google Fonts
- Creates only an external link to Google Fonts
- Support CSS API v2
- Add dns-prefetch
- Add preconnect
- Add preload
- Download css/fonts to local project (No need external resources)
- Encode fonts to base64
---

<img src="/preview.png" class="light-img" width="1280" height="640" alt=""/>
<img src="/preview-dark.png" class="dark-img" width="1280" height="640" alt=""/>

[Google Fonts Module](https://github.com/nuxt-community/google-fonts-module) for [NuxtJS](https://nuxtjs.org).


## Features

<list :items="features"></list>

<p class="flex items-center">Enjoy light and dark mode:&nbsp;<app-color-switcher class="inline-flex ml-2"></app-color-switcher></p>
121 changes: 121 additions & 0 deletions docs/content/en/options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
title: Options
description: 'Adding options to enhance your Google Fonts module for Nuxt'
position: 3
category: Guide
---

## families

Adding [Google font families](https://developers.google.com/fonts/docs/css2#quickstart_guides)

Type: Object
Default: {}

```js{}[nuxt.config.js]
googleFonts: {
families: {
Roboto: true,
'Josefin+Sans': true,
Lato: [100, 300],
Raleway: {
wght: [100, 400],
ital: [100]
},
}
}
```

## display

The [font-display property](https://developers.google.com/fonts/docs/css2#use_font-display) lets you control what happens while the font is still loading or otherwise unavailable.

Type: String
Default: null

```js{}[nuxt.config.js]
googleFonts: {
display: 'swap' // 'auto' | 'block' | 'swap' | 'fallback' | 'optional'
}
```

## subsets

Some of the fonts in the Google Font Directory support multiple scripts (like Latin, Cyrillic, and Greek for example). In order to [specify which subsets](https://developers.google.com/fonts/docs/getting_started#specifying_script_subsets) should be downloaded the subset parameter should be appended to the URL.

Type: Array[String]|String
Default: []

```js{}[nuxt.config.js]
googleFonts: {
subsets: 'greek'
}
```

## prefetch

This option injects [dns-prefetch](https://developer.mozilla.org/en-US/docs/Web/Performance/dns-prefetch) into the head of your project.

```html
<link rel =" dns-prefetch "href =" https://fonts.gstatic.com/ "/>
```

Type: Boolean
Default: true

```js{}[nuxt.config.js]
googleFonts: {
prefetch: true
}
```

## preconnect

This option injects [preconnect](https://developer.mozilla.org/en-US/docs/Web/Performance/dns-prefetch#Best_practices) into the head of your project.

```html
<link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin />
```

Type: Boolean
Default: true

```js{}[nuxt.config.js]
googleFonts: {
prefetch: true
}
```

## preload

This option injects [preload](https://developer.mozilla.org/pt-BR/docs/Web/HTML/Preloading_content) into the head of your project.

```html
<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Roboto" />
```

Type: Boolean
Default: true

```js{}[nuxt.config.js]
googleFonts: {
preload: true
}
```

## useStylesheet

This option injects useStylesheet into the head of your project which is recommended for projects that use the AMP module that removes scripts.

```html
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto" />
```

Type: Boolean
Default: false

```js{}[nuxt.config.js]
googleFonts: {
useStylesheet: false
}
```
45 changes: 45 additions & 0 deletions docs/content/en/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: Setup
description: 'How to setup Google Fonts module in your Nuxt project'
position: 2
category: Guide
---

Check the [Nuxt documentation](https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-modules) for more information about installing and using modules in Nuxt.

## Installation

Add `@nuxtjs/google-fonts` dependency to your project:

<code-group>
<code-block label="Yarn" active>

```bash
yarn add --dev @nuxtjs/google-fonts
```

</code-block>
<code-block label="NPM">

```bash
npm install --save-dev @nuxtjs/google-fonts
```

</code-block>
</code-group>

Then, add `@nuxtjs/google-fonts` to the `buildModules` section of `nuxt.config.js`:

```js[nuxt.config.js]
{
modules: [
'@nuxtjs/google-fonts'
],
}
```

<alert type="warning">

If you are using Nuxt < v2.9 you have to install the module as a dependency (No --dev or --save-dev flags) and use modules section in nuxt.config.js instead of buildModules.

</alert>
10 changes: 10 additions & 0 deletions docs/content/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"title": "Google Fonts",
"url": "https://google-fonts@nuxtjs.org",
"logo": {
"light": "/logo-light.svg",
"dark": "/logo-dark.svg"
},
"github": "nuxt-community/google-fonts-module",
"twitter": "@nuxt_js"
}
7 changes: 7 additions & 0 deletions docs/nuxt.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import theme from '@nuxt/content-theme-docs'

export default theme({
docs: {
primaryColor: '#E24F55'
}
})
Loading

0 comments on commit 2feffa4

Please sign in to comment.